ym88659208ym87991671
Getting user devices (get devices) | Documentation SmartMarket
Skip to main content

Getting user devices (get devices)

The vendor queries for a list of the user's devices. Sber Smart Home returns the list.

Sample case:

  1. From time to time, the vendor queries Sber Smart Home for a list of user devices - it is needed to show an up-to-date information in the vendor's app.
  2. Sber Smart Home returns the list of user devices.
  3. The vendor updates its database and shows the up-to-date information in its application.

Query format

The vendor sends a query to Sber Smart Home endpoint: https://partners.iot.sberdevices.ru/. For the headers, see Query headers.

GET /v1/devices?user_id=<string>&device_ids=<device_ids>

Query parameters:

FieldTypeMandatory?Description
user_idstring✔︎User ID in the vendor’s system Sber Smart Home gets IDs during account linking and then stores them (see the Getting User Info (get user) method)
device_idslist<string>List of device IDs in the vendor's system. It is posted when the vendor needs to know whether a user of Sber Smart Home has any specific devices. For example, if the vendor wants to make sure that certain devices have been added to Sber Smart Home

Response format

Sber Smart Home sends a response to the vendor's endpoint. For the headers, see Query headers.

Success response:

FieldTypeMandatory?Description
deviceslist<object>✔︎List of user devices (see User device (device))
{
"devices": [
{
"id": string,
"name": string,
"default_name": string,
// ...
},
{
"id": string,
"name": string,
"default_name": string,
// ...
},
]
}

If an error occurs, you must return an object of the Common error (common error) type:

{
"code": integer,
"message": string,
"details": list<string>
}

Sample query and response

The vendor queries for a list of the user's devices. Sber Smart Home returns a list of two devices: a socket and a lamp.

Query:

curl -i -X GET /v1/devices?user_id=AB12345 HTTP/1.1 \
-H Host: example.com \
-H Content-Type: application/json \
-H Authorization: Bearer qwerty-1234-... \
-H X-Request-Id: abcd-0000-ifgh-...

Success response:

{
"devices": [
{
"id": "ABCD_003",
"name": "Kitchen outlet",
"default_name": "Smart outlet"
},
{
"id": "ABCD_005",
"name": "Night-light",
"default_name": "Smart Lamp"
},
]
}

Error response:

{
"code": 400,
"message": "Invalid argument",
"details": []
}