Post command from Postman - Error

Joystick3 years ago

Hi Anton,

I am trying to send a command to a Teltonika device from Postman but get error

"Unexpected character ('d' (code 100)): was expecting double-quote to start field name
 at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 6, column: 17] (through reference chain: org.traccar.model.Command["attributes"])"

Below are the body of the command. I have tried many other ways but cannot get it to work. Please assist.

{
"id": 0,
"deviceId": 249,
"description": "new",
"type": "custom",
"attributes": {data: "setparam 11807:1" }
}
Anton Tananaev3 years ago

Well, your JSON is invalid and the error message tells you exactly where the problem is.

Joystick3 years ago

Hi Anton,

So below body is the correct way?

{
"id": 0,
"deviceId": 249,
"description": "new",
"type": "custom",
"attributes": {"'data'": "setparam 11807:1" }
}
Anton Tananaev3 years ago

Are you kidding me?

Joystick3 years ago

Hi Anton,

I am really not sure how to sort it, after adding the quotes, "'data'", I received a 200 ok response so thought it was sorted.
Please point me in the correct direction.

Anton Tananaev3 years ago

Can you please explain why you have triple quoting there. Where on earth did you get it from?

Joystick3 years ago

Hi Anton,

I now have it as double quotes and get a 200 ok response but the parameter is not changed on the device. Below is the body.

 {
"id": 0,
"deviceId": 249,
"description": "new",
"type": "custom",
"attributes": {"data": "setparam 11807:1" }
}
Joystick3 years ago

Hi Anton,

I've sorted it, thanks. I've used a parameter that was not configurable via command. The one below worked. Thanks for the help.

{
"id": 0,
"deviceId": 249,
"description": "new",
"type": "custom",
"attributes": {"data": "setparam 13501:1" }
}