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

# Send Command Request Method: POST

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

URL Parameter

Parameter Name Format Required Description
device_id string yes device ID that received the data
qos int no whether device response is required, default to 0.
0: send at most once, don't care if device responds
1: at least once, if device does not response after received command, then will resend command on next login of device and if the command is within the validity period (see timeout parameter for the validity period definition).
timeout int no command valid time, default 0.
0: online command, if the device is online, it is sent to the device. If the device is offline, it is directly discarded.
>0: Offline command,If the device is online, it is sent to the device. If the device is offline, it is valid for the current time plus timeout period. If the device goes online, it will be sent to the device
unit: seconds
valid range: 0~2678400

HTTP Header

Parameter Name Format Required Description
api-key string yes must be masterkey or apikey with access to the device

http Request Content

User-defined data: json, string, binary data (less than 64K)

http Request Return Parameter

Parameter Name Format Description
errno int code for call error , 0 indicates call is successful
error string error description, "succ" indicats call is successful
data json device related information returned after successful interface call, see data description table
data Description Table
Parameter Name Format Description
cmd_uuid string command id, unique within the platform

Example 1 of Request

POST http://iot.zong.com.pk:8000/cmds?device_id=8029377 HTTP/1.1
api-key: l2aH*************BRtAo=
Host: iot.zong.com.pk:8000
Content-Length: 19

<this is a command>

Example 1 of Return: successfully create a command

{
    "errno": 0,
    "error": "succ",
    "data": {
        "cmd_uuid": "81572aae-fc34-5deb-8f06-ab45d73cb12b"
    }
}

Example 2 of Return : device is not online

{
    "errno": 10,
    "error": "device not online: 8029377"
}

Example 2 of Request: send offline command and require device response

POST http://iot.zong.com.pk:8000/cmds?device_id=8029377&qos=1&timeout=3600 HTTP/1.1
api-key: l2aH*************BRtAo=
Host: iot.zong.com.pk:8000
Content-Length: 19

<this is a command>

Example of Return

{
    "errno": 0,
    "error": "succ",
    "data": {
        "cmd_uuid": "81572aae-fc34-5deb-8f06-ab45d73cb12b"
    }
}

results matching ""

    No results matching ""