V2.4 Get Gateway


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

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.4/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.
requireSecret Optional Boolean
  • true: deviceSecret and sessionKey will be returned. Ensure that:

    • Your service account has been granted with the required permission. If not, the returned value of deviceSecret and sessionKey will be an error.

  • false (default): deviceSecret and sessionKey will not be returned.

Response Parameters

Name Data Type Description
data Device Struct The information of the gateway device. For more details, see Device Struct.

Error Codes

Code Message Description
11858 Unable to find public key Unable to find public key for requireSecret due to there is no RSA key pair for the service account. Creating RSA Key Pairs >>.

Samples

Request Sample

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

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":"EncryptedDeviceSecret",
        "sessionKey":"EncryptedSessionKey",
        "deviceDesc": null,
        "timezone": "+08:00",
        "deviceAttributes": {},
        "deviceTags": {},
        "mirrorSource": null,
        "firmwareVersion": null,
        "createTime": 1560759829419,
        "status": "inactive",
        "activeTime": 0,
        "lastOnlineTime": 0,
        "lastOfflineTime": 0,
        "measurepointLastUpate": null,
        "eventLastUpdate": null,
        "attributeLastUpdate": 1561447707379,
        "featureLastUpdate": 1561447707379
    }
}

SDK Samples


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