Add new device
Request format: POST
URL: http://api.onenet.hk.chinamobile.com/devices
http body parameter
Name |
Format |
Required or not |
Description |
title |
string |
Yes |
Device name |
desc |
string |
No |
Device description |
tags |
array- string |
No |
Device tag. There may be one or more device tags. See the example. |
location |
json |
No |
Coordinates of the device location, expressed as a longitude and latitude key-value pair: {“lon”:xx, “lat”:xx} |
private |
bool |
No |
Device privacy, determining the visibility of device information in the sharing link of the application editor, true by default |
auth_info |
json |
Yes |
Authentication information. Format: {“DTU-sn”: “DTU- password”}. See the example. |
other |
json |
No |
Other custom information of the device, in the key-value pair format. See the example. |
Return Parameters
Name |
Format |
Description |
errno |
int |
Call error code, where 0 means success. |
error |
string |
Error description. “succ” means the call is successful. |
data |
json |
Device-related information returned after interface is successfully called. See the Data Description Table. |
Data Description Table
Name |
Format |
Description |
device_id |
string |
Device ID |
Example of request body
{
"title": "test_device",
"desc": "test_desc",
"tags": ["china", "mobile"],
"location": {
"lon": 109,
"lat": 23.54
},
"auth_info": {"13888888888": "00000000"},
"other": {
"version": "1.0.0",
"manufacturer": "china mobile"
}
}
Return Example
{
"errno": 0,
"data": {
"device_id": "35270468"
},
"error": "succ"
}