Updated on 2022-09-01 GMT+08:00

Response for Adding a Gateway Subdevice

Topic

Topic

/v1/devices/{gatewayId}/topo/addResponse

Publisher

IoT platform

Subscriber

Edge device

Parameter Description

After a subdevice is added successfully, a response containing information about the new subdevice is returned. During secondary development, information about the new subdevice needs to be saved locally. The returned deviceId field is used for reporting subdevice data, updating the subdevice status, and deleting the subdevice.

Response parameter description

Field

Mandatory/Optional

Type

Description

mid

Mandatory

Integer

Command ID.

statusCode

Mandatory

Integer

Result code for request processing. The options are as follows:

  • 0: success
  • non-0: failure

statusDesc

Optional

String

Response status description.

data

Mandatory

List< AddDeviceRsp >

Information about the added subdevice.

AddDeviceRsp struct description

Field

Mandatory/Optional

Type

Description

statusCode

Mandatory

Integer

Result code for request processing. The options are as follows:

  • 0: success
  • non-0: failure

statusDesc

Optional

String

Response status description.

deviceInfo

Optional

DeviceInfo

Device information.

DeviceInfo struct description

Field

Mandatory/Optional

Type

Description

nodeId

Mandatory

String

Device identifier.

The value must contain 2 to 64 characters and can consist of only uppercase and lowercase letters, digits, and hyphens (-).

deviceId

Mandatory

String

Unique device ID generated by the IoT platform, which corresponds to the device client ID.

name

Mandatory

String

Device name.

The value must contain 2 to 64 characters and can consist of only uppercase and lowercase letters, digits, hyphens (-), and number signs (#).

description

Optional

String

Device description.

The value length cannot exceed 200 characters.

manufacturerId

Mandatory

String

Manufacturer ID.

The value must contain 2 to 50 characters and can consist of only uppercase and lowercase letters, digits, hyphens (-), and underscores (_).

model

Mandatory

String

Product model.

The value must contain 2 to 50 characters and can consist of only uppercase and lowercase letters, digits, hyphens (-), and underscores (_).

Example

{
       "data": [{
              "deviceInfo": {
                     "manufacturerId": "Test_n",
                     "name": "n-device",
                     "model": "A_n",
                     "nodeId": "n-device",
                     "deviceId": "D59eGSxy"
              },
              "statusCode": 0
       }],
       "mid": 7,
       "statusCode": 0
}