Call this API to query the gateway device information using sub-device information.

Request Parameters

Parameter Type Required Description
Action String Yes The operation that you want to perform. Set the value to: GetGatewayBySubDevice.
IotId String No

The ID of the sub-device.

Note If you use this parameter, ProductKey and DeviceName are not required. IotId is the globally unique identifier (GUID) of a device, and corresponds to the combination of ProductKey and DeviceName. If you specify both IotId and the combination of ProductKey and DeviceName, the system follows IotId.
ProductKey String No

The product key of the sub-device.

Note If you use this parameter, DeviceName is required.
DeviceName String No

The name of the sub-device.

Note If you use this parameter, ProductKey is required.
Common Request Parameters - Yes See Common parameters.

Response parameters

Parameter Type Description
RequestId String The globally unique ID generated by Alibaba Cloud for the request.
Success Boolean Indicates whether the call is successful. A value of true indicates that the call is successful. A value of false indicates that the call has failed.
ErrorMessage String The error message returned when the call fails.
Code String The error code returned when the call fails. For more information about error codes, see Error codes.
Data Data The information of the gateway device. See DeviceDetailInfo.
Table 1. DeviceDetailInfo
Parameter Type Description
ProductKey String The product key of the gateway device.
ProductName String The product name of the gateway device.
DeviceName String The name of the gateway device.
DeviceSecret String The device secret of the gateway device.
IotId String The globally unique ID of the gateway device.
GmtCreate String The time when the gateway device was created, in GMT.
GmtActive String The time when the gateway device was activated, in GMT.
GmtOnline String The last time when the gateway device went online, in GMT.
UtcCreate String The time when the gateway device was created, in UTC.
UtcActive String The time when the gateway device was activated, in UTC.
UtcOnline String The last time when the gateway device went online, in UTC.
Status String

The status of the gateway device. Value options:

ONLINE

OFFLINE

UNACTIVE

DISABLE

FirmwareVersion String The firmware version number of the gateway device.
IpAddress String The IP address of the gateway device.
NodeType Integer The node type of the device, which is a value of 1 indicating that it is a gateway.
Region String The region of the gateway device.

Examples

Request example

https://iot.cn-shanghai.aliyuncs.com/?Action=GetGatewayBySubDevice
&ProductKey=al*********S
&DeviceName=XTzosqEOgxFXKPRgd8zl
&<Public Request Parameters>

Response example

  • JSON format

    {
    "RequestId": "F227A41E-8A0F-4829-A1B1-727619DB58A3",
        "Data": 
        {
            "Status": "UNACTIVE",
            "ProductName": "TEST",
            "DeviceSecret": "nICOJkFJnG***********TWnvXHydEjX",
            "UtcOnline": "",
            "IotId": "9a1MTdk9brqQ2bhdG4OY001094fd00",
            "GmtCreate": "2018-08-07 15:54:15",
            "UtcCreate": "2018-08-07T07:54:15.000Z",
            "UtcActive": "",
            "GmtActive": "",
            "NodeType": 1,
            "Region": "cn-shanghai",
            "GmtOnline": "",
            "ProductKey": "a15tzTmkWZ2",
            "DeviceName": "d896e0ff000105bb"
            "IpAddress": "10.0.0.1"
            "FirmwareVersion": "1.2.3"
        },
    "Success": true
    }
  • XML format

    <? xml version='1.0' encoding='utf-8'? >
    <GetGatewayBySubDeviceResponse>
        <RequestId>57b144cf-09fc-4916-a272-a62902d5b207</RequestId>
        <Success>true</Success>
        <Data>
            <Status>UNACTIVE</Status>
            <ProductName>TEST</ProductName>
            <DeviceSecret>nICOJkFJnG***********TWnvXHydEjX</DeviceSecret>
            <UtcOnline></UtcOnline>
            <IotId>SR8FiTu1R9tlUR2V1bmi0010******</IotId>
            <GmtCreate>2018-08-07 15:54:15</GmtCreate>
            <UtcCreate>2018-08-07T07:54:15.000Z</GmtOnline>
            <UtcActive></UtcActive>
            <GmtActive></GmtActive>
            <NodeType>1</NodeType>
            <Region>cn-shanghai</Region>
            <GmtOnline></GmtOnline>
            <ProductKey>a15tzTmkWZ2</ProductKey>
            <DeviceName>TEST</DeviceName>
            <IpAddress>10.0.0.1</IpAddress>
            <FirmwareVersion>1.2.3</FirmwareVersion>
        </Data>
    </GetGatewayBySubDeviceResponse>