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

View Datapoint

Request Method: GET

URL: http://iot.zong.com.pk:8000/devices/device_id/datapoints

device_id: need to be replaced with device ID

http Header

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

url Parameter

Parameter Name Format Required Description
datastream_id string no datastream, multiple datastreams separated by commas
start string no start time of extracting datapoint, format: 2015-01-10T08:00:35
end string no the end time of extracting datapoint, format: 2015-01-10T08:00:35
limit int no limit the maximum number of datapoints returned by this request, value >0, <=6000
cursor string no specify this request to continue extracting data starting from the cursor location

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
data json datapoint related information returned after successful interface call, see data description table
data Description Table
Parameter Name Format Description
cursor string location of next datapoint
datastream array-json json array of device datastream information, see datastreams description table
count int number of datastreams returned
datastreams Description Table
Parameter Name Format Description
id string datastream name
datapoints array-json json array of datapoint, see datapoints description table
statistic json json of dataflow statistic, see statistic description table
datapoints Description Table
Parameter Name Format Description
at string time
value string datapoint value
statistic Description Table
Parameter Name Format Description
at string a max(min) point of time returned when calculating the max(min) value
value string datapoint value
Description
 Call directly without any parameter. Then return the latest data in all datastreams of this device. If the device has three datastreams, then return the last of each of the three datastreams.
 When limit parameter is carried, and id parameter of datastream is not carried, will return up to "limit" pieces of data of each datastream of the device.
 Where datastream_id is equal to obj_id_obj_inst_id_ res_id, such as obj_id: 3200, obj_inst_id: 0, res_id: 5501, then this datastream_id is 3200_0_5501.
 To view data of a datastream over a certain time range, can add start and end parameter. Note that if start parameter exists, end parameter does not exist, means to extract all data after start; if start parameter does not exist, but end parameter exists, the device cloud will ignore end parameter. The max time interval between start and end parameter is 1 year, if exceed one year, then will ignore them.
 If start parameter is specified, then number of datapoints returned may be too many, and by default, 100 datapoints at most will be returned. The limit parameter can be used to set the number of datapoints to return, 6000 datapoints at most. When the actual number of datapoints is greater than the limit number, there will be a cursor field in the returned json string. The next request command line can carry this cursor field to indicate that the datastream is then traversed. This cursor field identifies the location of the next data point after the last time the data point was fetched.

Example 1 of Request

GET http://iot.zong.com.pk:8000/devices/564280/datapoints? datastream_id=3200_0_5501&start=2015-11-30T17:12:33&end=2015-12-01T17:22:33&limit=5&cursor=25971_564280_1448961024981 HTTP/1.1
api-key: WhI*************v1c=
Host: iot.zong.com.pk:8000

Example of Return

{
    "errno":0,
    "data":{
        "cursor":"25971_564280_1448961152173",
        "count":5,
        "datastreams":[
            {
                "datapoints":[
                    {
                        "at":"2015-12-01 17:10:24.981",
                        "value":"35"
                    },
                    {
                        "at":"2015-12-01 17:10:53.406",
                        "value":"38"
                    },
                    ...
                ],
                "id":"3200_0_5501"
            },
            ...
        ]
    },
    "error":"succ"}

results matching ""

    No results matching ""