Gateway Requesting for Adding Child Devices
Function
This API is used by a gateway to register new child devices on the platform.
Topic
Upstream: $oc/devices/{device_id}/sys/events/up
Parameters
Parameter |
Mandatory or Optional |
Type |
Description |
---|---|---|---|
object_device_id |
Optional |
String |
Identifies a gateway. |
services |
Mandatory |
List<ServiceEvent> |
Indicates a list of services that the event is about. |
ServiceEvent structure
Parameter |
Mandatory or Optional |
Type |
Description |
---|---|---|---|
service_id |
Mandatory |
String |
System field. The value is fixed to $sub_device_manager. |
event_type |
Mandatory |
String |
System field. The value is fixed to add_sub_device_request. |
event_time |
Optional |
String |
Indicates the time when the event occurs. |
event_id |
Optional |
String |
Uniquely identifies an event. If this parameter is not carried, an event ID will be generated by the platform. An event ID is a random string of 36 characters consisting of letters, numbers, and hyphens (-). |
paras |
Mandatory |
Object |
Indicates the event parameters in JSON format. |
paras structure
Parameter |
Mandatory or Optional |
Type |
Description |
---|---|---|---|
devices |
Mandatory |
List<DeviceInfo> |
Indicates a list of child devices to add. Up to 50 child devices can be added at a time. |
DeviceInfo structure
Parameter |
Mandatory or Optional |
Type |
Description |
---|---|---|---|
parent_device_id |
Optional |
String |
Identifies the parent device, that is, the gateway. |
node_id |
Mandatory |
String |
Indicates the node ID. |
device_id |
Optional |
String |
Identifies a device. If this parameter is carried, the platform will use the parameter value as the device ID. Otherwise, the platform will allocate a device ID, which is in the format of [product_id]_ [node_id]. |
name |
Optional |
String |
Indicates the device name. |
description |
Optional |
String |
Indicates the device description. |
product_id |
Mandatory |
String |
Uniquely identifies the product associated which the device. The value is allocated by the platform after the product model is imported to the IoTDA console. |
extension_info |
Optional |
Object |
Indicates the device extended information, which can be customized. The maximum size of the value is 1 KB. |
Example
Topic: $oc/devices/{device_id}/sys/events/up Data format: { "object_device_id": "{object_device_id}", "services": [ { "service_id": "$sub_device_manager", "event_type": "add_sub_device_request", "event_time": "20151212T121212Z", "event_id": "40cc9ab1-3579-488c-95c6-c18941c99eb4", "paras": { "devices": [ { "name": "subdevice11", "node_id": "subdevice11", "product_id": "c6b39067b0325db34663d3ef421a42f6", "description": "subdevice11" }, { "name": "subdevice12", "node_id": "subdevice12", "product_id": "c6b39067b0325db34663d3ef421a42f6", "description": "subdevice12" } ] } } ] }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot