V2.1 Get Gateway


Get the gateway information based on the specified sub-device.


This API is available in EnOS 2.1.0 and above. Version 2.4 has been added and it is recommended to use V2.4 Get Gateway.

If you need to invoke this API after performing bulk updates to relevant gateways or sub-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.1/device-topos?action=getGateway

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

subDevice

Mandatory

DeviceIdentifier Struct

The information of the sub-device. For more details, see DeviceIdentifier Struct.

Response Parameters

Name

Data Type

Description

data

Device Struct

The information of the gateway device. For more details, see Device Struct.

Samples

Request Sample

url: https://{apigw-address}/connect-service/v2.1/device-topos?action=getGateway&orgId=yourOrgId
method: POST
requestBody:
{
    "subDevice":{
        "assetId":"yourAssetId"
    }
}

Return Sample

{
    "code": 0,
    "msg": "OK",
    "requestId": "49ef6c03-02a0-449b-ab1e-92812071de80",
    "data": {
        "orgId": "yourOrgId",
        "assetId": "J1Rqyaqz",
        "modelId": "AlterTest0617",
        "modelIdPath": "/AlterTest0617",
        "productKey": "yourProductKey",
        "productName": {
            "defaultValue": "testtopo",
            "i18nValue": {}
        },
        "productType": "Gateway",
        "dataFormat": "Json",
        "deviceKey": "yourDeviceKey",
        "deviceName": {
            "defaultValue": "testtopo",
            "i18nValue": {}
        },
        "deviceSecret": "yourDeviceSecret",
        "deviceDesc": null,
        "timezone": "+08:00",
        "deviceAttributes": {},
        "deviceTags": {},
        "mirrorSource": null,
        "firmwareVersion": null,
        "createTime": 1560759829419,
        "status": "inactive",
        "activeTime": 0,
        "lastOnlineTime": 0,
        "lastOfflineTime": 0,
        "lastOfflineTime": 0,
        "measurepointLastUpate": null,
        "eventLastUpdate": null,
        "attributeLastUpdate": 1561447707379,
        "featureLastUpdate": 1561447707379
    }
}

SDK Samples


You can access the SDK samples for Connection Service on GitHub: