Start a new topic
Answered

Linted JSON still returns invalid error

I tried everything from this thread verbatim, copying and pasting to make sure it's right, and I still get  the response:

{ "errors" : [ { "message" : "Invalid json" } ] }

 I ran the code through JSONLint and it says my code is valid, but I can't get it to work.


Any help?


Thanks.


Best Answer

Tom, the JSON object is correct. The only thing is that the icon id should be "i849" to be displayed correctly on the device. Could you please also provide more details on the request you are trying to send to the device? We are interested in URL and headers. 


I think setting priority and sound only works for the notifications app, not for your own app

Hi
I have used same code like this in  curl command, I get the same error:


curl -X POST \
> -H "Accept: application/json" \
> -H "X-Access-Token: <mytoken>" \
> -H "Cache-Control: no-cache" \
> -d '{
>  "priority": "critical",
>  "model": {
>  "cycles": 1,
>  "frames": [{
>  "icon": "i849",
>  "text": "HELLO!"
>  }],
>  "sound": {
>  "category": "notifications",
>  "id": "cat"
>  }
>  }
> }
> ' \
> https://developer.lametric.com/api/v1/dev/widget/update/com.lametric.c096a00f664dc51df34914839bdfa2a9/3
{"error":{"message":"Bad Request","trace":{"frames":"frames must not be empty"}}}

Regards, Martin
Answer

Tom, the JSON object is correct. The only thing is that the icon id should be "i849" to be displayed correctly on the device. Could you please also provide more details on the request you are trying to send to the device? We are interested in URL and headers. 

 

{
	"priority": "critical",
	"model": {
		"cycles": 1,
		"frames": [{
			"icon": "#849",
			"text": "HELLO!"
		}],
		"sound": {
			"category": "notifications",
			"id": "cat"
		}
	}
}

 

Hi Tom, could you please copy and paste here JSON you are trying to send? We will check whether it works and get back to you. Thanks!

Login or Signup to post a comment