Get Device List

Last Updated on : 2023-06-20 15:21:53download

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

API address

GET: /v1.2/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 and mini program dimension under the home system.
  • tuyaUser: a device at the dimension of the Tuya Smart account.
  • product: a device that is linked with a product dimension.
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 device name.
categoryStringqueryfalseThe category of a specified product.
product_idStringqueryfalseThe ID of a specified product.
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 there is a next page.
listListThe 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).
categoryStringThe category of a specified product.
category_nameStringThe name of a specified category.
nameStringThe device name.
product_idStringThe product ID.
product_nameStringThe name of a specified product.
local_keyStringThe secret key.
subBooleanIndicates whether it is a sub-device.
asset_idStringThe asset ID.
owner_idStringThe ID of a specified home.
ipStringThe IP address of a specified device.
lonStringThe longitude.
latStringThe latitude.
modelStringThe product model.
time_zoneStringThe time zone.
active_timeLongThe time when a specified device is activated.
update_timeLongThe time when a specified device is updated.
create_timeLongThe time when the device is paired for the first time.
onlineBooleanThe online status of a specified device.
iconStringThe icon of a specified device.

Request example

GET: /v1.2/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/1526276264k8q8l44swr2ennf6zx5u92j4i_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.