OneNET IoT Platform Platform Introduction Introduction Manual Guidline for Device Development Guideline for Application Development
API
API Usage API List SDK MQTT LwM2M EDP Modbus TCP
HTTP Push

Instant Command - Write Device Resources

Request Method: POST

URL: http://iot.zong.com.pk:8000/nbiot

http Header

Parameter Name Format Required Description
api-key string yes must be masterkey or apikey with access authority of the device
Content-Type string yes must be application/json

url Parameter

Parameter Name Format Required Description
imei string yes identity code of nbiot device
obj_id int yes object id of device , determined according to sdk of terminal device
obj_inst_id int yes a specific instance id under nbiot device object, determined according to sdk of terminal device
mode int yes write mode, can only be 1 or 2
timeout int no time for request timeout, default to 25 (unit: second), range of values [5, 40]

http Request Parameter

Parameter Name Format Required Description
data array-json yes write values to specified resource
data Description Table
Parameter Name Format Required Description
res_id int yes specifies the resource id that write operates on
type int no currently support 1 and 2, 1 indicates the resource type is Opaque, and here the val field is the hexadecimal string corresponding to the binary; 2 indicates the resource type is Time, and here the val field is timestamp (unit: seconds, numberic value)
val object yes determine the value type of val according to the type of the specified resource, which can be boolean, string, long, double

Return Parameter

Parameter Name Format Description
errno int code for call error , 0 indicates call is successful
error string error description, "succ" indicates call is successful
Description

For the meaning of returned errno status code, can [download to view] in the OneNET Documentation Center -> Device Development Guide -> Protocol Document -> “Description of Returned Status Code of Northbound api in NB Protocol” in LWM2M (/book/device-develop/multpro /sdk-doc-tool/doc.md)

mode value: 1 , indicates replace, means to replace the value of specified instance or resource ; 2, indicats partial update, means to update the value of given resource or resource instace only

Example of Request

POST http://iot.zong.com.pk:8000/nbiot HTTP/1.1
api-key: WhI*************v1c=
Content-Type: application/json
Host: iot.zong.com.pk:8000

Example of Request Parameter

Non-opaque type:
{
    "data":[
        {
            "res_id":12,
            "val":121
        }
    ]
}

opaque type:
{
    "data":[
        {
            "res_id":12,
            "type":1,
            "val":121
        }
    ]
}

Example of Return

{
    "errno": 0,
    "error": "succ"
}

results matching ""

    No results matching ""