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).

Note RAM users of an Alibaba Cloud account share the quota of the account.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

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 instance ID. This parameter is not required for public instances. However, this parameter is required for Enterprise Edition instances.

ProductKey String No a1BwAGV****

The key of the product to which the devices belong.

Note If you specify this parameter, you must also specify the DeviceName parameter.
DeviceName String No light

The name 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 of the device. The ID is the unique identifier that is issued by IoT Platform to the device.

Note If you specify this parameter, you do not need to specify the ProductKey or DeviceName parameter. The IotId parameter specifies a unique identifier for the device, and corresponds to a combination of the ProductKey and DeviceName parameters. If you specify the IotId parameter and a combination of the ProductKey and DeviceName parameters at the same time, the IotId parameter takes precedence.

In addition to the preceding operation-specific request parameters, you must specify common request parameters when you call this API 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 details of the devices returned if the call succeeds.

DeviceName String gateway

The name of the gateway.

DeviceSecret String dCYdTU3gw5Z77bsHjPk6lPHPVnBT****

The device secret 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 user 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 user 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 user 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 key of the product to which the gateway belongs.

ProductName String LinkIoT

The product name of the device.

Status String online

The status of the gateway. Valid values:

  • online: The device is online.
  • offline: The device is offline.
  • unactive: The device is not activated.
  • disable: The device is disabled.
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 user 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 user 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 user resides is calculated based on the time zone of the region.

iotId String WuyjPSDQE1L22z1d****000100

The ID of the 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 has 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 succeeds.

  • true: The call succeeded.
  • false: The call failed.

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.