Get Device List

Last Updated on : 2023-06-20 15:22:52download

Get a list of devices that meet specific criteria under a project.

API address

GET: /v1.3/iot-03/devices

Request parameter

Parameter nameTypeINRequiredDescription
source_typeStringqueryfalseIncludes devices at different dimensions. Valid values:
  • asset: a device at the industry asset dimension. Default value.
  • homeApp: a device that is linked with an app or mini program under the home system.
  • tuyaUser: a device that is linked with an account of the Tuya Smart system.
  • product: a device that is linked with a poduct.
source_idStringqueryfalseA different business ID is entered depending on the source_type. Valid values:
  • Pass in the asset ID at the asset dimension.
  • Pass in the app schema at the homeApp dimension.
  • Pass in the user ID (UID) at the tuyaUser dimension.
  • Pass in the product ID at the product dimension.
device_idsStringqueryfalseThe list of device IDs. Maximum value: 20 each time.
nameStringqueryfalseThe name of a specified device.
categoryStringqueryfalseThe category of a specified product.
product_idStringqueryfalseThe product ID.
last_row_keyStringqueryfalseThe row key of the last page.
page_sizeIntegerqueryfalseThe number of items returned on each page. Default value: 20. Maximum value: 200.

Return parameter

Parameter nameTypeDescription
resultCursorPageThe returned result.

Description of result

Parameter nameTypeDescription
has_moreBooleanSpecifies whether to return the next page.
listListThe list of returned data.
last_row_keyStringThe row key of the last page.
totalLongThe total entries of data that meets the criteria.

Description of list

Parameter nameTypeDescription
idStringThe device ID.
gateway_idStringThe gateway ID. The value is empty for non-gateway sub-devices.
node_idStringThe node ID. The value is empty for non-gateway sub-devices.
uuidStringThe universally unique identifier (UUID) of a device.
categoryStringThe category of a specified product.
category_nameStringThe name of a specified product category.
nameStringThe name of a specified device.
product_idStringThe product ID.
product_nameStringThe product name.
local_keyStringThe secret key.
subBooleanIndicates whether it is a sub-device.
asset_idStringThe asset ID.
owner_idStringThe home ID.
ipStringThe IP address of a specified device.
lonStringThe longitude.
latStringThe latitude.
modelStringThe product model.
time_zoneStringThe time zone.
active_timeLongThe time when a device is activated.
update_timeLongThe time when a device is updated.
create_timeLongThe time when the device is paired for the first time.
onlineBooleanThe online status of a specified device.
iconStringThe device icon.

Request example

GET: /v1.3/iot-03/devices?category=xx&product_id=xx&name=xx&device_ids=xx&last_row_key=xx&page_size=xx

Return example

{
    "result": {
        "last_row_key": "B4C4EBD263D95628587B9643840E****",
        "list": [
            {
                "sub": false,
                "category_name": "Light Source",
                "create_time": 1567395627,
                "local_key": "8ab649951d59****",
                "owner_id": "3125****",
                "ip": "124.90.34.***",
                "icon": "smart/icon/1526276264k8q8l44swr2ennf6zx5u92***_0.png",
                "lon": "120.0***",
                "time_zone": "+08:00",
                "product_name": "Light",
                "uuid": "38042025cc50e325****",
                "gateway_id": "",
                "active_time": 1620299529,
                "update_time": 1635939139,
                "product_id": "ylr9R01cMWnM****",
                "name": "Light",
                "online": false,
                "model": "LE7",
                "id": "38042025cc50e325****",
                "category": "dj",
                "lat": "30.3***"
            }
        ],
        "total": 34,
        "has_more": true
    },
    "t": 1635940989216,
    "success": true
}

Error code

For more information, see error code.