API response "Invalid Json format" code 1011
-
Hello,
I am trying to send a downlink message to our devices. First I followed the documentation of “6: Send message to devkit” by which I used postman with the following results:
{{base_url}} = api.scs.iot.telekom.com
{{user:pass}} = base64 of the given API credentials user:pass
{{IMEI}} = one of our registered IMEI’sPUT: https://{{base_url}}/m2m/endpoints/IMEI:{{IMEI}}/downlinkMsg/0/data
HEAD: Content-Type: application/json
HEAD: Authorization: Basic {{user:pass}}
BODY RAW:
{
“resourceValue”: “48656c6c6f20446576696365”
}RESPONSE:
{
“msg”: “Authentication error”,
“code”: “1005”
}Afterwards I read in a different part of the documentation in “GETTING SERIOUS - IOTCREATORS.COM - Using the API” that first, a callback needs to be registered, which we deed and got a “msg”: “Success” response and I retried the previous call with the following response:
{
“msg”: “Invalid Json format”,
“code”: 1011
}Why do I get this error?
-
I just reached out to @Roalnd-Baldin, he will post something on Monday
-
@GrandPep Hi, normally you should get the “Invalid Json format” only if something is wrong with the JSON in the HTTP body.
Can you please provide the HTTP code snippet which you get displayed in Postman when you click the “</>” symbol on the very right side of the Postman window ?
Please make sure that you change the Authorization tokoen oand the IMEI before you share it with us.
Many thanks!
Roland -
@roalnd-baldin Hello Roland, thank you for your help.
I think I already found the problem: it seems that postman used an older cookie received from IoTcreators with which it returned the “Invalid Json format” error (altough I have no idea why a wrong cookie would cause such an error) but after removing all cookies, I received a new cookie and all seems to work now. -
@roalnd-baldin No it was not the cookie unfortunately… I simply read the wrong reply (of the registration) in my last response, sorry about that… The error still exists and the HTTP snippet is:
curl --location --request PUT ‘https://api.scs.iot.telekom.com/m2m/endpoints/IMEI:<IMEI NUMBER>/downlinkMsg/0/data’
–header ‘Content-Type: application/json’
–header ‘Authorization: Basic <BASE64 user:pass>’
–data-raw ‘{
“resourceValue”: “48656c6c6f20446576696365”
}’ -
@roalnd-baldin It seems to work with curl in command if the data-raw is rewritten like so:
–data-raw “{
\“resourceValue\”: \“48656c6c6f20446576696365\”
}”In command we get a nice “msg”:“Accepted”,“code”:1002 response but in Postman it does not work. And with the registration to https://{{base_url}}/m2m/applications/registration this was not an issue.