performance api

Ok i'm confused with the /api/v1/devices/xx:xx:xx:xx:xx:xx/performance call

If i pull a week worth i get like 7 sets of the below, but i honestly don't get what the first number is supposed to represent, i mean how do i turn these 7 groups of numbers into timestamps?

{ radio:
{ dl_throughput:
 { '6': 5755.70417,
 '7': 4412.06455,
 '8': 2598.61417,
 '9': 2399.14083,
 '10': 3946.50417,
 '11': 3806.40833,
 '12': 5598.89917,
 '13': 7726.4625,
 '14': 5898.09833,
 '15': 6020.94,
 '16': 7437.58,
 '17': 7660.75833,
 '18': 13011.46917,
 '19': 18643.44,
 '20': 17262.3,
 '21': 19147.19417,
 '22': 19632.62917,
 '23': 26100.73 } } }
 
Is there any way to adjust the resolution?
 

Each key in the data represents an hour of the day (0-23).

But which day as I checked in the weekly chart on the cnmaestro and the numbers don’t seem to match, not sending timestamps is a serious bit of confusing lol

Is their a way to get the smaller divisions like to see every 5 min for last few hours

Performance API behavior:

If time difference between start and stop time in the query

  • is more than a day, then each record will contain a day information(i.e, 0-23hrs) and timestamp shows respective date information.
  • less than 24hrs, then each record will contain 1 hr (i.e 0-55minutes) data and in timestamp respective hour information will be shown.

API Illustration:

Example-1:

https://{{server}}/api/v1/{{device_types}}/XX:XX:XX:XX:XX:XX/performance?start_time=2018-08-06T10:00:00&stop_time=2018-08-07T10:00:00


In the above api, we are querying from 6 to 7 date performance data. Based on the given time-stamp for Aug 6th records 14hrs data will be be shown (i.e, 9-23), for 7th record 10hrs data will be shown(i.e, 0-9).
Below are the records with timestamp.

"timestamp": "2018-08-06T00:00:00+00:00"
 "dl_throughput": {
"9": 3.325,
"10": 4.32636,
"11": 7.1675,
"12": 3.51583,
"13": 4.47833,
"14": 3.34545,
"15": 3.33167,
"16": 3.3475,
"17": 3.33083,
"18": 3.355,
"19": 3.33667,
"20": 3.33667,
"21": 3.33583,
"22": 3.34167,
"23": 3.33
},

"timestamp": "2018-08-07T00:00:00+00:00"
 "dl_throughput": {
"0": 3.35167,
"1": 3.3275,
"2": 3.34167,
"3": 3.3425,
"4": 3.335,
"5": 3.33667,
"6": 3.35333,
"7": 3.33833,
"8": 3.37583,
"9": 3.325
}

 Example-2:

If we want to get data for every 5minutes we have to give start_time & stop_time range less than 24hrs.

https://{{server}}/api/v1/{{device_types}}/XX:XX:XX:XX:XX:XX/performance?start_time=2018-08-07T17:00:00&stop_time=2018-08-07T17:00:00.

With this api can get only 17th hour data for every 5minutes.
ouput will be like below: Here keys will be minutes info.

timestamp": "2018-08-07T17:00:00+00:00",
"dl_throughput": { "0": 3.43, "5": 3.33, "10": 3.38, "15": 3.31, "20": 3.33, "25": 3.37, "30": 3.34, "35": 3.31, "40": 3.17, "45": 3.54, "50": 3.35, "55": 3.11 }


Now going back to your example output, you queried for 7days data, hence each record will contain 24hrs information.you can refer the timestamp attribute in response. If you want to query data for every 5minutes, you will need to adjust start_time, stop_time range as below in order to get 3 records, each record contains 1 hr data.

start_time=2018-08-07T7:00:00&stop_time=2018-08-07T10:00:00. 
6 Likes

Hi CSup,

Did lpk001's post answer your question?

Yep cleared it up though made programming consumption a bit annoying as had to convert to timestamps from start time plus the difference plus the array index which seems really odd

Maybe for v2 add an option to send unixtimestamps instead of a hour/minute interval count :S

Thanks again though it does work

Yep cleared it up though made programming consumption a bit annoying as had to convert to timestamps from start time plus the difference plus the array index which seems really odd

Maybe for v2 add an option to send unixtimestamps instead of a hour/minute interval count

Thanks again though it does work

1 Like

Thank you for the feedback on including timestamps for each individual datapoint in the API response data.  I have forwarded this on for consideration.