Queries the information of a gateway based on sub-device information.
Limits
Each Alibaba Cloud account can run a maximum of 50 queries per second (QPS).
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | GetGatewayBySubDevice |
The operation that you want to perform. Set the value to GetGatewayBySubDevice. |
IotInstanceId | String | No | iot_instc_pu****_c*-v64******** |
The ID of the instance. You can view the instance ID on the Overview page in the IoT Platform console. Notice
For more information, see Overview. |
ProductKey | String | No | a1BwAGV**** |
The ProductKey of the product to which the device belongs. Note If you specify this parameter, you must also specify the DeviceName parameter.
|
DeviceName | String | No | light |
The DeviceName of the sub-device. Note If you specify this parameter, you must also specify the ProductKey parameter.
|
IotId | String | No | Q7uOhVRdZRRlDnTLv****00100 |
The ID of the sub-device. The ID is a unique identifier that is issued by IoT Platform to the sub-device. Note If you specify this parameter, you do not need to specify ProductKey or DeviceName. The IotId parameter specifies a globally unique identifier (GUID) of the device, which corresponds
to a combination of ProductKey and DeviceName. If you specify both IotId and the combination of ProductKey and DeviceName, IotId takes precedence.
|
In addition to the preceding operation-specific request parameters, you must specify common request parameters when you call this operation. For more information, see Common request parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Code | String | iot.system.SystemException |
The error code returned if the call fails. For more information, see Error codes. |
Data | Struct |
The gateway details returned if the call is successful. |
|
DeviceName | String | gateway |
The DeviceName of the gateway. |
DeviceSecret | String | dCYdTU3gw5Z77bsHjPk6lPHPVnBT**** |
The DeviceSecret of the gateway. |
FirmwareVersion | String | V1.0.1 |
The firmware version number of the device. |
GmtActive | String | 2019-12-18 23:25:30 |
The activation time of the gateway. The time is displayed in GMT. The time is the local time of the region where the gateway resides. |
GmtCreate | String | 2019-12-18 16:58:33 |
The creation time of the gateway. The time is displayed in GMT. The time is the local time of the region where the gateway resides. |
GmtOnline | String | 2020-01-20 17:41:04 |
The last online time of the gateway. The time is displayed in GMT. The time is the local time of the region where the gateway resides. |
IpAddress | String | 106.**.1**.** |
The IP address of the gateway. |
NodeType | String | 1 |
The node type. The value 1 indicates that the device is a gateway. |
ProductKey | String | a1BwAGV**** |
The ProductKey of the product to which the gateway belongs. |
ProductName | String | LinkIoT |
The name of the product to which the gateway belongs. |
Status | String | online |
The status of the gateway device. Valid values:
|
UtcActive | String | 2019-12-18T15:25:30.176Z |
The activation time of the gateway. The time is displayed in UTC. The actual time of the region where the gateway resides is calculated based on the time zone of the region. |
UtcCreate | String | 2019-12-18T08:58:33.000Z |
The creation time of the gateway. The time is displayed in UTC. The actual time of the region where the gateway resides is calculated based on the time zone of the region. |
UtcOnline | String | 2020-01-20T09:41:04.879Z |
The last online time of the gateway. The time is displayed in UTC. The actual time of the region where the gateway resides is calculated based on the time zone of the region. |
iotId | String | WuyjPSDQE1L22z1d****000100 |
The ID of the gateway device. The ID is the unique identifier that is issued by IoT Platform to the device. |
region | String | cn-shanghai |
The region where the gateway resides. This region corresponds to the region that is displayed in the IoT Platform console. |
ErrorMessage | String | A system exception occurred. |
The error message returned if the call fails. |
RequestId | String | E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565 |
The ID of the request. |
Success | Boolean | true |
Indicates whether the call was successful.
|
Examples
Sample requests
https://iot.cn-shanghai.aliyuncs.com/?Action=GetGatewayBySubDevice
&ProductKey=a1BwAGV****
&DeviceName=XTzosqEOgxFXKPRgd8zl
&<Common request parameters>
Sample success responses
XML
format
<GetGatewayBySubDeviceResponse>
<Data>
<region>cn-shanghai</region>
<DeviceName>gateway_04</DeviceName>
<GmtActive>2019-12-18 23:25:30</GmtActive>
<ProductKey>a1vL7cp****</ProductKey>
<IpAddress>106.**.1**.**</IpAddress>
<GmtCreate>2019-12-18 16:58:33</GmtCreate>
<UtcCreate>2019-12-18T08:58:33.000Z</UtcCreate>
<UtcOnline>2020-01-20T09:41:04.879Z</UtcOnline>
<UtcActive>2019-12-18T15:25:30.176Z</UtcActive>
<Status>online</Status>
<NodeType>1</NodeType>
<GmtOnline>2020-01-20 17:41:04</GmtOnline>
<ProductName>LinkIoTEdge_Gateway</ProductName>
<iotId>WuyjPSDQE1L22z1****000100</iotId>
</Data>
<RequestId>0377D5A9-BDE1-48C2-96C9-BDC048899186</RequestId>
<Success>true</Success>
</GetGatewayBySubDeviceResponse>
JSON
format
{
"Data": {
"region": "cn-shanghai",
"DeviceName": "gateway_04",
"GmtActive": "2019-12-18 23:25:30",
"ProductKey": "a1vL7cp****",
"IpAddress": "106.**.1**.**",
"GmtCreate": "2019-12-18 16:58:33",
"UtcCreate": "2019-12-18T08:58:33.000Z",
"UtcOnline": "2020-01-20T09:41:04.879Z",
"UtcActive": "2019-12-18T15:25:30.176Z",
"Status": "online",
"NodeType": 1,
"GmtOnline": "2020-01-20 17:41:04",
"ProductName": "LinkIoTEdge_Gateway",
"iotId": "WuyjPSDQE1L22z1****000100"
},
"RequestId": "0377D5A9-BDE1-48C2-96C9-BDC048899186",
"Success": true
}
Error codes
For a list of error codes, visit the API Error Center.