V2.4 Search Sub-Device¶
Search for sub-devices under the specified gateway.
This API is only available if 2.4 Cumulative Update 1 has been applied to your environment.
If you need to invoke this API after performing bulk updates to relevant devices using other APIs, it is recommended to wait for about 2 seconds to avoid obtaining unupdated data.
Request Format¶
POST https://{apigw-address}/connect-service/v2.4/device-topos?action=searchSubDevice
Request Parameters (URI)¶
Name |
Location (Path/Query) |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|---|
orgId |
Query |
Mandatory |
String |
The organization ID which the asset belongs to. How to get orgId>> |
Request Parameters (Body)¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
gateway |
Mandatory |
DeviceIdentfier Struct |
Information of the gateway the sub-devices are under. For details, see DeviceIdentfier Struct. |
requireSecret |
Optional |
Boolean |
|
expression |
Optional |
String |
The query expression, which supports sql-like query. The fields that are supported for query include:
|
pagination |
Optional |
Pagination Request Struct |
Lists the paging requirements in a request. When not specified, 10 records are displayed per page by default. The maximum records per page is 200 but for optimal performance, it is recommended to have not more than 50 records per page. |
projection |
Optional |
Projection Struct |
Enables you to crop the data result set returned in the request if needed. Only the specified fields will be returned in the data result set if this parameter is used. Otherwise all fields are returned. For more details, see How does projection crop the result set>> |
DeviceIdentifier Struct ¶
Note
Use either the (assetId
) or (productKey
+ deviceKey
) for the following.
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
assetId |
Optional (See Note above) |
String |
The asset ID. How to get assetId>> |
productKey |
Optional (See Note above) |
String |
The product key. To be used with |
deviceKey |
Optional (See Note above) |
String |
The device key. To be used with |
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
Array of Device Structs |
A list of the devices returned. For the details of a Device Struct, see Device Struct. |
Device Struct ¶
Name |
Data Type |
Description |
---|---|---|
orgId |
String |
The organization ID which the asset belongs to. |
assetId |
String |
The asset ID. |
modelId |
String |
The model ID which the asset belongs to. |
modelIdPath |
String |
The model ID path. |
productKey |
String |
The product key. |
productName |
StringI18n |
The product name. |
productType |
String |
The product type. |
dataFormat |
String |
|
deviceKey |
String |
The device key. |
deviceName |
StringI18n |
The device name. |
deviceSecret |
String |
The device secret, returned only when the value of |
sessionKey |
String |
The key for encrypting and decrypting the value of |
deviceDesc |
String |
The device description. |
timezone |
String |
Timezone of the device’s location. |
deviceAttributes |
Map |
The device attributes. The Key is the attribute ID, and the Value type depends on the attribute defined in the |
deviceTags |
Map |
The device tags. (The Key and Value are of String type.) |
mirrorSource |
String |
The device key of the mirror source. |
createTime |
Long |
The time when the device was created. |
status |
String |
The device status (online, offline, inactive, disable, or mirror)
|
activeTime |
Long |
The time when the device was activated. |
lastOnlineTime |
Long |
The last online time of the device. |
lastOfflineTime |
Long |
The last offline time of the device. |
measurepointLastUpdate |
Long |
The last time when a measurement point was updated. |
eventLastUpdate |
Long |
The last time when an event was updated. |
attributeLastUpdate |
Long |
The last time when an attribute was updated. |
featureLastUpdate |
Long |
The last time when a measurement point, an event, or an attribute was updated. |
firmwareVersion |
String |
The firmware version. |
Error Codes¶
Code |
Message |
Description |
---|---|---|
11738 |
Not Gateway |
The device specified in |
99400 |
Invalid arguments |
One or multiple parameters are invalid. |
11858 |
Unable to find public key |
Unable to find public key for |
Samples¶
Request Sample¶
url: https://{apigw-address}/connect-service/v2.4/device-topos?action=searchSubDevices&orgId=yourOrgId
method: POST
requestBody:
{
"gateway":{
"assetId":"yourAssetId"
},
"requireSecret": true
}
Return Sample¶
{
"code": 0,
"msg": "OK",
"requestId": "498d1c5b-7c4f-401a-a9ff-9072931bec2e",
"data": [{
"orgId": "yourOrgId",
"assetId": "mAEsF3sm",
"modelId": "AlterTest0617",
"modelIdPath": "/AlterTest0617",
"productKey": "yourProductKey",
"productName": {
"defaultValue": "AlterTest0617_Product",
"i18nValue": {}
},
"productType": "Device",
"dataFormat": "Json",
"deviceKey": "yourDeviceKey",
"deviceName": {
"defaultValue": "testforCreatedevice",
"i18nValue": {}
},
"deviceSecret":"EncryptedDeviceSecret1",
"sessionKey":"EncryptedSessionKey1",
"deviceDesc": "test for createdevice",
"timezone": "+08:00",
"deviceAttributes": {
"testatt": 111111
},
"deviceTags": {},
"mirrorSource": null,
"firmwareVersion": null,
"createTime": 1560755091998,
"status": "inactive",
"activeTime": 0,
"lastOnlineTime": 0,
"lastOfflineTime": 0,
"measurepointLastUpdate": null,
"eventLastUpdate": null,
"attributeLastUpdate": null,
"featureLastUpdate": null
}, {
"orgId": "yourOrgId",
"assetId": "gVRwKQ3C",
"modelId": "AlterTest0617",
"modelIdPath": "/AlterTest0617",
"productKey": "yourProductKey",
"productName": {
"defaultValue": "AlterTest0617_Product",
"i18nValue": {}
},
"productType": "Device",
"dataFormat": "Json",
"deviceKey": "yourDeviceKey",
"deviceName": {
"defaultValue": "AlterTest0617_Product",
"i18nValue": {}
},
"deviceSecret":"EncryptedDeviceSecret2",
"sessionKey":"EncryptedSessionKey2",
"deviceDesc": null,
"timezone": "+10:00",
"deviceAttributes": {},
"deviceTags": {},
"mirrorSource": null,
"firmwareVersion": null,
"createTime": 1560730295671,
"status": "offline",
"activeTime": 1560730567958,
"lastOnlineTime": 1560743932166,
"lastOfflineTime": 1560744112166,
"measurepointLastUpdate": null,
"eventLastUpdate": null,
"attributeLastUpdate": null,
"featureLastUpdate": null
}],
"pagination":{"sortedBy":null,"pageNo":1,"pageSize":2,"totalSize":2}}
SDK Samples¶
You can access the SDK samples for Connection Service on GitHub: