Get Gateway


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

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
    }
}

Java SDK Sample

package com.envisioniot.enos.api.sample.connect_service.device.topo;

import com.envision.apim.poseidon.config.PConfig;
import com.envision.apim.poseidon.core.Poseidon;
import com.envisioniot.enos.connect_service.v2_1.device.topo.GetGatewayRequest;
import com.envisioniot.enos.connect_service.v2_1.device.topo.GetGatewayResponse;
import com.envisioniot.enos.connect_service.vo.DeviceIdentifier;


public class GetGateWay {
    public static void main(String[] args) {
        final String appKey = "yourAppKey";
        final String appSecret = "yourAppSecret";
        String serverUrl = "yourSeverUrl";

        String orgId = "yourOrgId";
        GetGatewayRequest request = new GetGatewayRequest();
        request.setOrgId(orgId);
        request.setSubDevice(new DeviceIdentifier("zGeKTDrw"));


        GetGatewayResponse response = Poseidon.config(PConfig.init().appKey(appKey).appSecret(appSecret).debug())
                .url(serverUrl)
                .getResponse(request, GetGatewayResponse.class);
    }}