Obtenir des résumés des flux de chaînes 2022-07-26

Overview

The Get Channel Feed Summaries API is used to read feed summaries from all the sensor fields in a channel. This method can return either a JSON or CSV object. Each feed summary record consists hourly sum total, average, number of records, standard deviation, maximum and minimum values of each individual field.

If you only need to access the latest readings from the channel, using the Get Channels API is recommended. It will return latest readings from all the channels in once. 

API URL

To return a JSON object:

https://api.ubibot.com/channels/CHANNEL_ID/summary.json?parameters

To return a CSV file:

https://api.ubibot.com/channels/CHANNEL_ID/summary.csv?parameters

Where CHANNEL_ID is the ID of the target channel.

HTTP Method

GET

URL Parameters

NameTypeRequiredDescription
api_key or token_idStringRequired for private channelsSpecify the API write key or read key of the channel, or token_id obtained after the user logged in.
resultsIntegerOptionalNumber of entries to retrieve. The maximum number is 8,000
startDatetimeOptionalStart date in format YYYY-MM-DD%20HH:NN:SS.
endDatetimeOptionalEnd date in format YYYY-MM-DD%20HH:NN:SS.
timezoneStringOptionalIdentifier from Time Zones Reference for this request.
callbackStringOptionalFunction name to be used for JSONP cross-domain requests.

 Response

An HTTP code of 200 is responded for each successful data requests. Body contains a JSON object with the feed summaries in the requested format. If is_truncated is presented in the response JSON and value is true, it means the result has been truncated because of the maximum number of entries for retrieving has been reached. You can change the start and end value to shrink the range.

Error: See the list of error codes for details.

Examples

GET https://api.ubibot.com/channels/123/summary?api_key=XXXXXXXXXXXXX

The response is a JSON object, for example:

{
 "result": "success",
 "server_time": "2019-02-07T13:13:15Z",
 "is_truncated": false,
 "start": "2019-02-07T02:00:00+00:00",
 "end": "2019-02-07T11:00:00+00:00",
 "timezone": "Europe/London",
 "num_records": 10,
 "results": 10,
 "channel": {
 "channel_id": "1419",
 "name": "C-1419",
 "field1": "Temperature",
 "field2": "Humidity",
 "field3": "Light",
 "field4": "Voltage",
 "field5": "WIFI RSSI",
 "field6": "Vibration Index",
 "field7": "Knocks",
 "field8": "External Temperature Probe",
 "field9": "Reed Sensor",
 "field10": null,
 "latitude": "41.7922",
 "longitude": "123.4328",
 "elevation": null,
 "created_at": "2018-12-07T03:15:40Z",
 "public_flag": "false",
 "user_id": "8D5F3ACB-87A5-4D80-AA5F-FC64E8647990",
 "last_entry_date": "2019-02-07T13:10:26Z",
 "last_entry_id": "50982",
 "vconfig": "{\"field1\":{\"h\":\"0\",\"u\":\"1\"},\"field2\":{\"h\":\"0\",\"u\":\"3\"},\"field3\":{\"h\":\"0\",\"u\":\"4\"},\"field4\":{\"h\":\"0\",\"u\":\"5\"},\"field5\":{\"h\":\"0\",\"u\":\"6\"},\"field6\":{\"h\":\"0\",\"u\":\"7\"},\"field7\":{\"h\":\"0\",\"u\":\"8\"},\"field8\":{\"h\":\"0\",\"u\":\"1\"},\"field9\":{\"h\":\"0\",\"u\":\"9\"}}",
 "full_dump": "0",
 "plan_code": "ubibot_free",
 "username": "cloudleader"
 },
 "feeds": [{
 "created_at": "2019-02-07T11:00:00+00:00",
 "field3": {
 "sum": 0.24,
 "avg": 0.06,
 "count": 4,
 "sd": 0,
 "max": 0.06,
 "min": 0.06
 },
 "field1": {
 "sum": 94.515136,
 "avg": 23.628784,
 "count": 4,
 "sd": 0.018257971122225,
 "max": 23.646141,
 "min": 23.603416
 },
 "field2": {
 "sum": 40,
 "avg": 10,
 "count": 4,
 "sd": 0,
 "max": 10,
 "min": 10
 },
 "field5": {
 "sum": -160,
 "avg": -40,
 "count": 4,
 "sd": 0,
 "max": -40,
 "min": -40
 }
 }, {
 "created_at": "2019-02-07T10:00:00+00:00",
 "field3": {
 "sum": 0.69,
 "avg": 0.062727272727273,
 "count": 11,
 "sd": 0.0044536177141512,
 "max": 0.07,
 "min": 0.06
 },
 "field1": {
 "sum": 260.85257,
 "avg": 23.71387,
 "count": 11,
 "sd": 0.035359001690453,
 "max": 23.803696,
 "min": 23.675514
 },
 "field2": {
 "sum": 110,
 "avg": 10,
 "count": 11,
 "sd": 0,
 "max": 10,
 "min": 10
 },
 "field5": {
 "sum": -487,
 "avg": -44.272727272727,
 "count": 11,
 "sd": 4.3294112362875,
 "max": -40,
 "min": -49
 },
 "field4": {
 "sum": 4.472982,
 "avg": 4.472982,
 "count": 1,
 "sd": 0,
 "max": 4.472982,
 "min": 4.472982
 }
 }, {
 "created_at": "2019-02-07T09:00:00+00:00",
 "field3": {
 "sum": 22.48,
 "avg": 11.24,
 "count": 2,
 "sd": 1.74,
 "max": 12.98,
 "min": 9.5
 },
 "field1": {
 "sum": 48.264282,
 "avg": 24.132141,
 "count": 2,
 "sd": 0.021362,
 "max": 24.153503,
 "min": 24.110779
 },
 "field2": {
 "sum": 20,
 "avg": 10,
 "count": 2,
 "sd": 0,
 "max": 10,
 "min": 10
 },
 "field5": {
 "sum": -80,
 "avg": -40,
 "count": 2,
 "sd": 0,
 "max": -40,
 "min": -40
 }
 }, {
 "created_at": "2019-02-07T08:00:00+00:00",
 "field3": {
 "sum": 457.879989,
 "avg": 38.15666575,
 "count": 12,
 "sd": 12.868984722494,
 "max": 57.32,
 "min": 16.779999
 },
 "field1": {
 "sum": 294.736777,
 "avg": 24.561398083333,
 "count": 12,
 "sd": 0.27719641719199,
 "max": 25.056076,
 "min": 24.209579
 },
 "field2": {
 "sum": 113,
 "avg": 9.4166666666667,
 "count": 12,
 "sd": 0.49300664859163,
 "max": 10,
 "min": 9
 },
 "field5": {
 "sum": -512,
 "avg": -42.666666666667,
 "count": 12,
 "sd": 4.0892813821284,
 "max": -40,
 "min": -51
 },
 "field4": {
 "sum": 4.475632,
 "avg": 4.475632,
 "count": 1,
 "sd": 0,
 "max": 4.475632,
 "min": 4.475632
 }
 }, {
 "created_at": "2019-02-07T07:00:00+00:00",
 "field3": {
 "sum": 200.879997,
 "avg": 100.4399985,
 "count": 2,
 "sd": 2.6000025,
 "max": 103.040001,
 "min": 97.839996
 },
 "field1": {
 "sum": 56.227211,
 "avg": 28.1136055,
 "count": 2,
 "sd": 0.2456705,
 "max": 28.359276,
 "min": 27.867935
 },
 "field2": {
 "sum": 16,
 "avg": 8,
 "count": 2,
 "sd": 0,
 "max": 8,
 "min": 8
 },
 "field5": {
 "sum": -90,
 "avg": -45,
 "count": 2,
 "sd": 4,
 "max": -41,
 "min": -49
 }
 }, {
 "created_at": "2019-02-07T06:00:00+00:00",
 "field3": {
 "sum": 31344.398927,
 "avg": 2612.0332439167,
 "count": 12,
 "sd": 2824.6816531297,
 "max": 7016.959961,
 "min": 116.199997
 },
 "field1": {
 "sum": 378.384835,
 "avg": 31.532069583333,
 "count": 12,
 "sd": 2.9701401037999,
 "max": 35.892273,
 "min": 26.377892
 },
 "field2": {
 "sum": 87,
 "avg": 7.25,
 "count": 12,
 "sd": 1.0103629710818,
 "max": 9,
 "min": 6
 },
 "field5": {
 "sum": -491,
 "avg": -40.916666666667,
 "count": 12,
 "sd": 0.27638539919628,
 "max": -40,
 "min": -41
 },
 "field4": {
 "sum": 4.487029,
 "avg": 4.487029,
 "count": 1,
 "sd": 0,
 "max": 4.487029,
 "min": 4.487029
 }
 }, {
 "created_at": "2019-02-07T05:00:00+00:00",
 "field3": {
 "sum": 197.159996,
 "avg": 98.579998,
 "count": 2,
 "sd": 1.579998,
 "max": 100.159996,
 "min": 97
 },
 "field1": {
 "sum": 46.082627,
 "avg": 23.0413135,
 "count": 2,
 "sd": 0.0146865,
 "max": 23.056,
 "min": 23.026627
 },
 "field2": {
 "sum": 20,
 "avg": 10,
 "count": 2,
 "sd": 0,
 "max": 10,
 "min": 10
 },
 "field5": {
 "sum": -89,
 "avg": -44.5,
 "count": 2,
 "sd": 4.5,
 "max": -40,
 "min": -49
 }
 }, {
 "created_at": "2019-02-07T04:00:00+00:00",
 "field3": {
 "sum": 1133.039978,
 "avg": 94.419998166667,
 "count": 12,
 "sd": 6.4416674668395,
 "max": 115.040001,
 "min": 89.68
 },
 "field1": {
 "sum": 277.075209,
 "avg": 23.08960075,
 "count": 12,
 "sd": 0.015318618498007,
 "max": 23.114746,
 "min": 23.069351
 },
 "field2": {
 "sum": 120,
 "avg": 10,
 "count": 12,
 "sd": 0,
 "max": 10,
 "min": 10
 },
 "field5": {
 "sum": -535,
 "avg": -44.583333333333,
 "count": 12,
 "sd": 5.3456888133232,
 "max": -40,
 "min": -52
 },
 "field4": {
 "sum": 4.469537,
 "avg": 4.469537,
 "count": 1,
 "sd": 0,
 "max": 4.469537,
 "min": 4.469537
 }
 }, {
 "created_at": "2019-02-07T03:00:00+00:00",
 "field3": {
 "sum": 153.099998,
 "avg": 76.549999,
 "count": 2,
 "sd": 0.549999,
 "max": 77.099998,
 "min": 76
 },
 "field1": {
 "sum": 46.242844,
 "avg": 23.121422,
 "count": 2,
 "sd": 0.0066760000000006,
 "max": 23.128098,
 "min": 23.114746
 },
 "field2": {
 "sum": 20,
 "avg": 10,
 "count": 2,
 "sd": 0,
 "max": 10,
 "min": 10
 },
 "field5": {
 "sum": -82,
 "avg": -41,
 "count": 2,
 "sd": 0,
 "max": -41,
 "min": -41
 }
 }, {
 "created_at": "2019-02-07T02:00:00+00:00",
 "field3": {
 "sum": 1153.739984,
 "avg": 96.144998666667,
 "count": 12,
 "sd": 50.714404305812,
 "max": 256.320007,
 "min": 73.059998
 },
 "field1": {
 "sum": 278.933775,
 "avg": 23.24448125,
 "count": 12,
 "sd": 0.069417701157708,
 "max": 23.352409,
 "min": 23.141449
 },
 "field2": {
 "sum": 122,
 "avg": 10.166666666667,
 "count": 12,
 "sd": 0.37267799624997,
 "max": 11,
 "min": 10
 },
 "field5": {
 "sum": -536,
 "avg": -44.666666666667,
 "count": 12,
 "sd": 7.3861732687201,
 "max": -40,
 "min": -66
 },
 "field4": {
 "sum": 4.497895,
 "avg": 4.497895,
 "count": 1,
 "sd": 0,
 "max": 4.497895,
 "min": 4.497895
 }
 }]
}

PHP Quickstarts