Posting user devices (post devices)

The vendor notifies Sber Smart Home that a user has added one device or more.

Sample case:

  1. A user adds one or more devices in the vendor application.
  2. The vendor sends a notification to Sber Smart Home about the added devices.
  3. Sber Smart Home posts new devices in Salute mobile app, SberPortal, SberBox and other devices supported with Salute assistants.

Query format

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

POST /v1/devices

Query body:

Field Type Mandatory? Description
user_id string ✔︎ User ID. Sber Smart Home gets IDs during account linking and then stores them (see the Getting User Info (get user) method)
devices list<object> ✔︎ List of added devices (see User device (device))
{
    "user_id": string,
    "devices": [
        {
            "id": string,
            "name": string,
            "default_name": string,
            // ...
        },
        {
            "id": string,
            "name": string,
            "default_name": string,
            // ...
        },
    ]
}

Response format

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

Success response:

HTTP/1.1 200 OK

If an error occurs, the endpoint may return:

  • A list of errors containing error objects. Each object points to specific devices with their adding unsuccessful.
  • A common error. that describes the problem as a whole and is returned when the problem cannot be juxtaposed with specific devices.

If a vendor notified of several devices, and Sber Smart Home has managed to post some of them, but an error occurs when posting the rest, Sber Smart Home will send an error response containing a list of devices not posted.

Device-specific error:

{
    "errors": [
        {
            "id": string,
            "code": integer,
            "message": string
        }
    ]
}

General error:

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

Sample query and response

In the sample, the user adds a smart lamp. The vendor notifies Sber Smart Home about it.

Query:

curl -i -X POST /v1/devices HTTP/1.1 \
-H Host: example.com \
-H Content-Type: application/json \
-H Authorization: Bearer qwerty-1234-... \
-H X-Request-Id: abcd-0000-ifgh-...
{
    "user_id": AB12345
    "devices": [
        {
        "id": "ABCD_005",
        "name": "Night-light",
        "default_name": "Smart Lamp"
        }
    ]
}

Success response:

HTTP/1.1 200 OK

Error response:

{
    "errors": [
        {
            "id": "ABCD_005",
            "code": 500,
            "message": "System error"
        }
    ]
}