Getting information about the device status
Requesting information about the current status of the user device.
Request format
GET https://api.iot.yandex.net/v1.0/devices/{device_id}
device_id |
ID of the user device. |
Request headers
Header |
Description |
Required |
Authorization |
The authorization token of the OAuth application. |
Yes |
Response format
HTTP/1.1 200 OK
{
"status": "ok",
"request_id": String,
"id": String,
"name": String,
"aliases": [String],
"type": "devices.types.{type}",
"state": String,
"groups": [String],
"room": String,
"external_id": String,
"skill_id": String,
"capabilities": [{
"retrievable": Boolean,
"type": "devices.capabilities.{capability}",
"parameters": {},
"state": {},
"last_updated": Float
},
{
"retrievable": Boolean,
"type": "devices.capabilities.{capability}",
"parameters": {},
"state": {},
"last_updated": Float
}
],
"properties": [{
"retrievable": Boolean,
"type": "devices.properties.{property}",
"parameters": {},
"state": {},
"last_updated": Float
},
{
"retrievable": Boolean,
"type": "devices.properties.{property}",
"parameters": {},
"state": {},
"last_updated": Float
}
]
}
Parameter |
Type |
Description |
Required |
status |
String |
Status of processing the request. Acceptable values:
|
Yes |
request_id |
String |
Request ID. Must be logged for the purpose of incident investigation. |
Yes |
id |
String |
Device ID. |
Yes |
name |
String |
The name of the device. |
Yes |
aliases |
Array of Strings |
An array with additional device names. |
Yes |
room |
String |
The ID of the device room. The |
Yes |
external_id |
String |
The ID of the device in the manufacturer's cloud. |
Yes |
skill_id |
String |
The ID of the device manufacturer's skill |
Yes |
type |
String |
Yes |
|
state |
String |
The state of the device. Acceptable values:
|
Yes |
groups |
Array of Strings |
Array with IDs of the device's groups. |
Yes |
capabilities |
Array of CapabilityObjects |
Array with information about device capabilities. |
Yes |
properties |
Array of PropertyObjects |
Array with information about the device properties. |
Yes |
capabilities
array
Parameter |
Type |
Description |
Required |
capability1 |
Description of capability. |
No |
|
capability2 |
Description of capability. |
No |
properties
array
Parameter |
Type |
Description |
Required |
property1 |
Property description. |
No |
|
property2 |
Property description. |
No |
CapabilityObject
type
Parameter |
Type |
Description |
Required |
type |
String |
Yes |
|
retrievable |
Boolean |
If it's possible to request the state of this device capability. |
Yes |
parameters |
CapabilityParametersObject |
Capability parameters. Corresponds to the value of the |
Yes |
state |
CapabilityStateObject |
Current capability state. If the value is |
Yes |
last_updated |
Float |
The time of the last state update in seconds, in the Unix timestamp format. |
Yes |
PropertyObject
type
Parameter |
Type |
Description |
Required |
type |
String |
Yes |
|
retrievable |
Boolean |
Whether the state of this device property can be requested. |
Yes |
parameters |
PropertyParametersObject |
Property parameters. Corresponds to the value of the |
Yes |
state |
PropertyStateObject |
Current property state. If the value is |
Yes |
last_updated |
Float |
The time of the last state update in seconds, in the Unix timestamp format. |
Yes |
HTTP/1.1 404 Not Found
{
"request_id": String,
"status": "error",
"message": String
}
Parameter |
Type |
Description |
Required |
request_id |
String |
Request ID. Must be logged for the purpose of incident investigation. |
Yes |
status |
String |
Status of processing the request. Acceptable values:
|
Yes |
message |
String |
Error message. |
No |
Example
curl -i -X GET 'https://api.iot.yandex.net/v1.0/devices/lamp-id-1' \
-H 'Authorization: Bearer 123qwe456a...'
HTTP/1.1 200 OK
{
"status": "ok",
"request_id": "fd9299b8-f927-44f1-8728-8a0b35f1c72a",
"id": "lamp-id-1",
"name": "Лампочка 1",
"aliases": [],
"type": "devices.types.light",
"state": "online",
"groups": [
"light-group-id-1"
],
"room": "room-id-1",
"external_id": "external-lamp-id-1",
"skill_id": "skill-id-1",
"capabilities": [{
"retrievable": true,
"type": "devices.capabilities.on_off",
"parameters": {
"split": false
},
"state": {
"instance": "on",
"value": false
},
"last_updated": 1626702522.614036
},
{
"retrievable": true,
"type": "devices.capabilities.range",
"parameters": {
"instance": "brightness",
"unit": "unit.percent",
"random_access": true,
"range": {
"min": 1,
"max": 100,
"precision": 1
}
},
"state": {
"instance": "brightness",
"value": 100
},
"last_updated": 1626702522.614036
},
{
"retrievable": true,
"type": "devices.capabilities.color_setting",
"parameters": {
"color_model": "rgb",
"temperature_k": {
"min": 1700,
"max": 6500
}
},
"state": {
"instance": "temperature_k",
"value": 3400
},
"last_updated": 1626702522.614036
}
],
"properties": []
}
HTTP/1.1 404 Not Found
{
"request_id": "9813e54b-021d-4203-b22a-02c6370d07b1",
"status": "error",
"message": "Устройство не найдено"
}
String enclosed in quotation marks, for example: "Hello, world"
.
An array of elements separated by a comma. As array items, you can use standard JSON elements: a string, number, true
, false
, object, or array. Arrays are enclosed in square brackets []
:
"cities": ["Moscow", "Tokyo", "New York"]
Floating-point number with a precision of 6-9 decimal digits.
Boolean value without quotes: true
or false
.
ID of the user device.
Type
String
Description
Required
Yes
Type
CapabilityStateObject
Description
Current capability state. If the value is null
, it means that the state was never transmitted to the system. Corresponds to the value of the state
field from the capability description.
Required
Yes
Type
String
Description
Error message.
Required
No
Type
String
Description
Status of processing the request. Acceptable values:
error
.
Required
Yes
Type
String
Description
Error message.
Required
No