Getting device categories (get categories)
Last updated on May 17, 2023
The agent app installed on the controller requests from Sber Smart Home a list of device categories supported by the Smart Home.
Use case example:
- When loading, the agent app compiles a control - a dropdown list indicating currently supported device categories. To complete the list, the agent requests the list of supported categories from Sber Smart Home.
- Sber Smart Home returns a list of categories.
- The agent app compiles a dropdown list indicating currently supported models.
Request format
A request is sent to the information API endpoint, the address of which is sent in a message indicating the global configuration. For the headers, see Query headers.
GET /v1/mqtt-gate/categories
Response format
Sber Smart Home sends the response to the agent app. For the headers, see Query headers.
Success response:
Field | Type | Mandatory? | Description |
categories | list<string> | ✔︎ | List of available device categories (see Description of devices) |
{
"categories": [
"category": string,
// ...
]
}
If an error occurs, a Common error (common error) object is returned:
{
"code": integer,
"message": string,
"details": list<string>
}
Sample query and response
The agent app requests the list of device categories supported by the Smart Home. Sber Smart Home returns two categories: LED strips and lamps.
Query:
curl -i -X GET /v1/mqtt-gate/categories HTTP/1.1 \
-H Host: example.com \
-H Content-Type: application/json \
-H Authorization: Basic qwerty-1234-... \
-H X-Request-Id: abcd-0000-ifgh-...
Success response:
{
"categories": [
"led_strip",
"light"
]
}
Error response:
{
"code": 500,
"message": "Internal server error",
"details": []
}