Get User's Device List

Last Updated on : 2024-09-10 01:49:20

Query the list of devices available to a specified user, as well as device details, including device attributes and status.

API address

GET: /v1.0/users/{uid}/devices

Request parameter

Parameter nameTypeINRequiredDescription
uidStringuritrueThe user ID (UID).
fromStringqueryfalseThe source. Valid value:
  • home: Query the devices in the rooms of the current user.
  • sharing: Query the shared devices that the current user has received.
page_noIntegerqueryfalseThe current page number. 1 means the first page.
page_sizeIntegerqueryfalseThe number of entries returned on each page.

Return parameter

Parameter nameTypeDescription
resultListThe returned result.

Description of result

Parameter nameTypeDescription
idStringThe device ID.
uuidStringThe universally unique identifier (UUID) of a specified device.
uidStringThe user ID.
biz_typeIntegerThe business type of an application.
nameStringThe device name.
time_zoneStringThe time zone.
ipStringThe IP address of a specified device.
local_keyStringThe secret key.
subBooleanIndicates whether it is a sub-device. Valid values:
  • true: yes.
  • false: no.
create_timeLongThe time when the device was first paired.
update_timeLongThe time when the device status was updated.
active_timeLongThe time when the device was last paired.
statusListThe status of a specified device feature.
owner_idStringThe ID of the device owner.
product_idStringThe product ID.
product_nameStringThe product name.
categoryStringThe product category.
iconStringThe icon of a specified device.
onlineBooleanIndicates whether the device is online. Valid values:
  • true: The device is online.
  • false: The device is offline.

Description of status

Parameter nameTypeDescription
codeStringThe code of a specified data point.
valueObjectThe value of a specified data point.

Request example

GET: /v1.0/users/ay15***********/devices
GET /v1.0/users/ay15ay15***********/devices?page_no=0&page_size=50

Return example

{
    "result": [
        {
            "sub": false,
            "create_time": 1540691155,
            "local_key": "11a53bdd67e4****",
            "owner_id": "357****",
            "ip": "**.62.43.**",
            "biz_type": 293964,
            "icon": "smart/product_icon/cz.png",
            "time_zone": "+08:00",
            "uuid": "27511006b4e62d4b****",
            "product_name": "Wi-Fi Smart Metering Socket",
            "active_time": 1548584422,
            "uid": "ay1548569152777Q****",
            "update_time": 1548584559,
            "product_id": "EvolhYPyZNWYP***",
            "name": "xxx Test",
            "online": true,
            "id": "27511006b4e62d4b****",
            "category": "cz",
            "status": [
                {
                    "code": "cur_power",
                    "value": 0
                },
                {
                    "code": "cur_voltage",
                    "value": 2196
                },
                {
                    "code": "switch",
                    "value": false
                },
                {
                    "code": "countdown_1",
                    "value": 0
                },
                {
                    "code": "cur_current",
                    "value": 0
                }
            ]
        }
    ],
    "t": 1564996327422,
    "success": true
}

Error code

For more information, see error code.