REST API: char and array parameter problem

Hello tangoer.

because JSON has not char data type, i want to execute DevVarCharArray command, how to set input value, `[48,49,50]` or `["0","1","2"]` all failed

PUT hosts/localhost/devices/sys/tg_test/1/commands/DevVarCharArray


{
"host": "localhost:10000",
"device": "sys/tg_test/1",
"name": "DevVarCharArray",
"input": [48,49,50]
}


When write attribute(s), i want to pass new value in request's body, but failed

PUT hosts/localhost/devices/sys/tg_test/1/attributes/long_spectrum/value"
# will set value to [], not [1,2,3,4]


{
"host": "localhost:10000",
"device": "sys/tg_test/1",
"name": "long_spectrum",
"value": [1,2,3,4]
}


thanks
Edited 3 years ago
Hi Jimmy,

As per version 2.1 DevVarCharArray is not supported.

Concerning long spectrum you should pass an argument as `v` query param:


PUT …/devices/sys/tg_test/1/attributes/long_spectrum/value?v=[1,2,3]


OR in encoded way:


PUT …/devices/sys/tg_test/1/attributes/long_spectrum/value?v=%5B1%2C2%2C3%5D


Hope this helps smile
Thank you Ingvord

For write attributes, should pass an argument as `v` query param. As from https://tango-rest-api.readthedocs.io/en/v1.1/device/#value have: argument can be passed in request's body. so i get can pass an argument as request body
Edited 3 years ago
That's true, you can pass arguments in body for multiple attributes reading/writing, e.g. https://tango-rest-api.readthedocs.io/en/v1.1/hosts/#attributes

For single device attributes query parameter `v` is used

Cheers,
Edited 3 years ago
 
Register or login to create to post a reply.