"Invalid JSON","error":"invalid_value" - json

Hi I am trying to use workato to create a task for Podio. I have successfully connected to Podio using their HTTP OAUTH2 connection, but when I try to actually create the task using JSON, I receive this from Podio:
This is from HTTP:
400 Bad Request:
{"error_parameters":{},"error_detail":null,"error_propagate":false,"request":{"url":"http://api.podio.com/task/","query_string":"","method":"POST"},"error_description":"Invalid
JSON","error":"invalid_value"}
The Code is as follows:
Request URL : https://api.podio.com/task/item/"the item id" <--This is where I would place the itemID of the item in Podio
Request header:
Authorization: OAuth2 [[User.SiteAccessToken]]
Content-type: application/json
Request Body:
{
"text": "Regarding Absence Request for Vacation",
"responsible":"{"type":profile, "id": "this is my profileID" }",
"description": "Your request for Vacation has been denied, please contact your manager."
}
but when I run this, I get this error message:
400 Bad Request:
{"error_parameters":{},"error_detail":null,"error_propagate":false,"request":{"url":"http://api.podio.com/task/item/436023600","query_string":"","method":"POST"},"error_description":"Invalid
JSON","error":"invalid_value"}
Now within the the request body or header does it need to have which app I am referring to not just the item ID. Not sure what it's looking for, if you could please assist with some guidance, that would be greatly appreciated.

I discovered that the issue was indeed the syntax within the JSON sent in the request body.
The quotes around the curly braces for responsible needed to be removed and I needed quotes with profile, and it should have gone like this:
{
"text": "Regarding Absence Request for Vacation",
"responsible": {"type":"profile", "id": 123 },
"description": "Your request for Vacation has been denied, please contact your manager."
}

Related

STH getting historical raw context

I installed Orion and Fiware STH in order to use the minimalistic option.
The problem is that when i subscribe to an orion context then consult, the array is null.
"name": "temperature",
"values": []
In the STH log it says:
ERROR when collecting the raw data collection for retrieval (the collection may not exist).
I noticed that when i try to unsubscribe it returns a 200 OK message with the following body:
{
"subscriptionId": "xxx",
"statusCode": {
"code": "404",
"reasonPhrase": "No context element found",
"details": "subscriptionId: /xxx/"
}
}
EDIT: The request URL is:
192.168.60.117:8080/STH/v1/contextEntities/type/room/id/Room‌​1/
(In my case the type is "room" and not "Room"). The headers are Accept,
Content-Type, Fiware-Service, Fiware-ServicePath
It looks like more a problem when you make the subscription to ORION than when the data is processed by STH, you can find how to make the subscription in Orion and how to notify to STH in this link: https://fiware-sth-comet.readthedocs.io/en/latest/data-storage/index.html, Also, if you provide more information of how you make the subscription and the logs I could have a better view of where is the problem and I can help you in a better way.

Error registering Weather Forcast data model (NGSI v2)

I am trying to register weather forcast on ContextBroker V1.5.0 but getting below error :-
400 Bad Request
{
"error": "BadRequest",
"description": "attribute must be a JSON object, unless keyValues option is used"
}
Request:
POST http://[ContextBroker IP]:1026/v2/entities
Request header :
Content-Type:application/json
Here is the payload
{
"feelsLikeTemperature":31.8,
"dayMinimum":{"feelsLikeTemperature":31.8,"temperature":0.0,"relativeHumidity":31.0},
"temperature":0.0,
"dateCreated":"2016-12-01T12:05:00+05:30",
"type":"WeatherForecast",
"address":{"addressCountry":"IN","postalCode":"452001","addressLocality":"Indore"},
"windSpeed":3.7,
"validity":{"to":"2016-12-01T06:44:37Z","from":"2016-12-01T06:44:37Z"},
"source":"http://dataservice.accuweather.com/",
"precipitationProbability":0,
"dayMaximum":{"feelsLikeTemperature":31.8,"temperature":0.0,"relativeHumidity":31.0},
"weatherType":"Partly sunny",
"windDirection":"ENE",
"id":"452001_IN_YYYY-12-DD ",
"relativeHumidity":31.0
}
I verified with FIWARE data models on http://fiware-datamodels.readthedocs.io/en/latest/Weather/WeatherForecast/doc/spec/index.html but it does not seem to be working. Does anyone know solution to this problem?
you are using the 'keyValues' representation so you need to do your POST with ?options=keyValues
by the way the WeatherForecast data model just landed updated with some adjustments to comply with GSMA specification.
http://fiware-datamodels.readthedocs.io/en/latest/Weather/WeatherForecast/doc/spec/index.html
thanks!

Chrome Web notification 'MismatchSenderId' error

I have deployed the sample code for Chrome push notifications and updated the gcm_sender_id to a newly configured project, the client is able to subscribe/unsubscribe without issue but when posting a request to send a notification the response MismatchSenderId is continually returned.
I have tried creating multiple new projects console.firebase.google.com, but nothing seems to work.
Request:
POST /gcm/send HTTP/1.1
Host: android.googleapis.com
Authorization: key=<Server Key/>
Content-Type: application/json
{
"registration_ids":[
"<Registration-ID/>"
]
}
Response:
{
"multicast_id": 6881038306061588882,
"success": 0,
"failure": 1,
"canonical_ids": 0,
"results": [
{
"error": "MismatchSenderId"
}
]
}
I am using the 'Server Key' as the request auth token (which works as 401 is returned when an invalid key is used) and am using the 'Sender ID' in the manifest:
manifest.json
{
"name": "Notification Demo",
"gcm_sender_id": "<Sender ID/>"
}
This was my own fault; the sample registration ID's were in a different format to the generated ones I was seeing and did not contain semicolons which I was using to strip the registration ID from the subscription endpoint string. Splitting the endpoint by a forward slash and taking the last instance returned the correct Registration ID which works fine.

Google Search Console 401 Bad Request issue without using Client Library

So, Here are 3 steps.
I called oAuth2 with following url:
https://accounts.google.com/o/oauth2/v2/auth
?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fwebmasters%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fwebmasters.readonly
&client_id=___.apps.googleusercontent.com
&redirect_uri=urn:ietf:wg:oauth:2.0:oob
&response_type=code
&approval_prompt=force
&access_type=offline
I get the code, suppose: 4/QVgPaCMqp94____qBC4NY_d54IcRj7U9mJc
Then I'm making a request for access_token, by making a POST request to https://accounts.google.com/o/oauth2/token with client_id, client_secret, redirect_uri, grant_type, and I get a JSON like:
'access_token' => ya29.CjHzAgC4js6Guv-1pt_rE____q8XIxiXOXOaSZW9NLRjKCTI3izBi,
'expires_in' => 3600,
'refresh_token' => 1/dL3ENA-EVI0rEb6D-OGqw_____iFe2ZNdEq4,
Now, I am making a request with that access_token or in cases of expiry with a renewed access_token to Google Search Console, which I have added in scopes.
My request is similar to this: https://developers.google.com/webmaster-tools/v3/urlcrawlerrorssamples/list#try-it
But I get an 401 unauthorized error, with a json like following:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
Considering I have done the process correctly, I think I have missing some parameters or providing some wrong value.
I have not used Google Client Library, instead used the REST API framework directly.
Can anybody give some clue please? Thank you.
The reason is, URL query parameter must be ?access_token= and not ?key= The later can be used only in case of direct API access and not oAuth.

authorization_invalid_request error when preparing DocuSign envelope for tab modification

I am trying trying to create a draft envelope from a template and then modify some of the tabs in the template. I'm getting an AUTHORIZATION_INVALID_REQUEST response.
My initial request is to the following URL https://demo.docusign.net/restapi/v2/accounts/<account id>/envelopes
and the payload is as follows:
{
"status": "created",
"emailSubject": "2015-01-27T16:25:43.133-05:00 Docusign Template Request",
"emailBlurb": "email blurb",
"templateId": "<template id>",
"brandId": "<brand id>",
"templateRoles": [
{
"name": "<name>",
"email": "<email>",
"roleName": "<role>",
"clientUserId": "",
"emailNotification": {
"supportedLanguage": "en",
"emailSubject": "<subject>",
"emailBody": "special email body"
}
}
],
"allowReassign": "true",
"enableWetSign": "false",
"messageLock": "false"
}
That produces the following response:
{
"envelopeId": "<envelope id>",
"uri": "/envelopes/<envelope id>",
"statusDateTime": "2015-01-28T22:09:43.9770000Z",
"status": "created"
}
Then I send a recipient view request to the following URL:
https://demo.docusign.net/restapi/v2/envelopes/<envelope id>/views/recipient using the envelope id received in the above response.
This results in the following response:
{
"errorCode": "AUTHORIZATION_INVALID_REQUEST",
"message": "The authorization request is malformed."
}
Note that if I had set the first request above to a status of "sent" (and thus did not create a draft envelope), the second request would have been successful.
However according to DocuSign documentation (p. 163 of the API guide), the modify tabs API call "modifies one or more tabs for a recipient to a draft envelope". Accordingly to perform a tab modification I need a draft envelope, not a sent one. But when I create a draft envelope, the views/recipient call fails as above.
I can add tabs successfully to a "sent" envelope. But I would rather modify tabs and am having trouble doing that.
You're not hitting a valid DocuSign Endpoint. Where did you get the /v2/envelopes/<envelope id>/views/recipient URL from? That's not a proper URL hence the error message you are getting.
After you create the envelope if you want to modify a given recipient's tabs then you need to make the following API call:
Modify Tabs for Recipient
Note that this is a PUT call not a POST, and URI is:
/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/tabs
For example, if you wanted to modify tabs for recipient who is recipientId = 3 you would make a call similar to (notice the 3 in the URL):
PUT https://demo.docusign.net/restapi/v2/accounts/12345/envelopes/{envelopeId}/
recipients/3/tabs
X-DocuSign-Authentication: <DocuSignCredentials><Username>{name}</Username><Password>{password}</Password><IntegratorKey>{integrator_key}</IntegratorKey></DocuSignCredentials>
Accept: application/json
Content-Type: application/json
{
"approveTabs":[{
<Tab information removed>
}],
"titleTabs":[{
<Tab information removed>
}],
"signHereTabs":[{
<Tab information removed>
}]
}
I'm not sure if this qualifies as an "answer" to my question, but it does appear that the problem has somehow been resolved. I let it rest for a couple days while I attended to other matters, then yesterday afternoon suddenly it started working, with no changes on my part. The specific part that wasn't working was attempting a PUT on an envelope in order to modify the tags. That is not supposed to work unless the envelope is a draft; my envelopes have all been drafts. Wasn't working a couple days ago, and now it is. #Pete and #Dorian: you might want to try it again if you haven't already; if you're not doing anything else wrong it might work now.