Hi,
We have started using the rest api for some developments that demand quite a lot of information from the database to the client application.
In the current standard, one needs to ask for the device name (/devices), then the attribute list (/devices/sys/tg_test/1/attributes), then the specific attribute (/devices/sys/tg_test/1/attributes/ampli) and then info (…/ampli/info) and value (…/ampli/value).
Unless you know the device and attribute name and you go straight to the value endpoint, there are quite a few calls to the get to the value, or juts to get all the relevant info for a given attribute. And multiply by the number of devices or attributes you want to access.
Would it be possible to add an optional depth argument that allows the addition of extra information in the response instead of only the url? Aggregating the info if the additional calls. For example:
GET /devices/sys/tg_test/1 would return:
“commands”:
{
“url”: “http://w-v-kitslab-cc-0:8909/tango/rest/rc3/hosts/w-v-kitslab-csdb-0.maxiv.lu.se/10000/devices/sys/tg_test/1/commands”,
“command_list”: [
{“name”: “DevBoolean”},
{“name”: “DevDouble”}
…
],
}
“attributes”:
{ “url”:“url”: “http://w-v-kitslab-cc-0:8909/tango/rest/rc3/hosts/w-v-kitslab-csdb-0.maxiv.lu.se/10000/devices/sys/tg_test/1/attributes”,
“attibute_list”:[
{“name”: “ampli”},
{“name”: “DevDouble”}
…
],
}
“properties”: { xxxxxx }
etc.
}
A depth of 0 would give the same response as todays standard, depth=1 would include command, attributes and property names only, depth 2 would include additional /info and /value data. A depth of 2 maybe has no sense when accessing attribute endpoint.
Similar consideration can be made at /devices level.
What do you think? Is this something worth considering for adding to the standard?
best regards,
mikel