# API requests for 'overTimeData10mins' returns data not matching the suggested value format

**URL:** https://discourse.pi-hole.net/t/api-requests-for-overtimedata10mins-returns-data-not-matching-the-suggested-value-format/65374
**Category:** General
**Tags:** v5-0, docker
**Created:** [October 7, 2023, 10:09am UTC](https://discourse.pi-hole.net/t/api-requests-for-overtimedata10mins-returns-data-not-matching-the-suggested-value-format/65374 "2023-10-07T10:09:25Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![SmartPhoneLover](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/smartphonelover/32/37868_2.png) [@SmartPhoneLover](https://discourse.pi-hole.net/u/SmartPhoneLover)
#### Post date: [October 7, 2023, 10:09am UTC](https://discourse.pi-hole.net/t/api-requests-for-overtimedata10mins-returns-data-not-matching-the-suggested-value-format/65374/1 "2023-10-07T10:09:25Z")

</div>

Hello,

I'm using **overTimeData10mins** to get the latest requests count for the 24h period (API 3.0).

After taking a look [here](https://discourse.pi-hole.net/t/pi-hole-api/1863), it seems that the expected result should be in the format of: 00:00:00 - 00:09:59, 00:10:00 - 00:19:59, and so on.  
But, after checking the output, it's in the format of: 00:05:00 - 00:14:59, 00:15:00 - 00:24:59, and so on.

Example output shown in JSON format (epoch time in seconds):

- Expected output: {"1488150 **000**":xx,"1488150 **600**":xx,"1488151 **200**":xx,(...)}
- Actual output: {"1696586 **100**":xx,"1696586 **700**":xx,"1696587 **300**":xx,(...)}

I'm building a project where I will show an hourly graph, so I need to take into consideration all the queries from xx:00:00 to xx:59:59. And if it's from xx:55:00 to xx:54:59 it makes it harder to calculate the correct amount of queries in an hour, because I have to add the corresponding queries of the first 5 minutes (previous hour), and substract the corresponding queries of the firsts 5 mins (next hour) o be able to have statistics for a complete hour.

But, the data that Pi-hole shows on its WebUI (graphs) are in the correct format.

Maybe, some offset has to be applied to compensate the output of the API?

---

<div class="post-metadata">

### Author: ![Bucking\_Horn](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/bucking_horn/32/18719_2.png) [@Bucking\_Horn](https://discourse.pi-hole.net/u/Bucking_Horn)
#### Post date: [October 7, 2023, 11:12am UTC](https://discourse.pi-hole.net/t/api-requests-for-overtimedata10mins-returns-data-not-matching-the-suggested-value-format/65374/2 "2023-10-07T11:12:27Z")

</div>

(_If that's indeed your expected output, you should check your system's time:  
 `1488150000` translates to Feb 27th 00:00:00 2017 (for a system in CET)._) 😉

I can confirm that `api.php?overTimeData10mins` returns 10 minutes slots starting at 5 minute boundaries, which is a deviation from the 0 minute boundaries shown on the dashboard.

@rdwebdesign, is this intentional, or is the web api calling FTL with an unwanted 5 minutes offset?

---

<div class="post-metadata">

### Author: ![SmartPhoneLover](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/smartphonelover/32/37868_2.png) [@SmartPhoneLover](https://discourse.pi-hole.net/u/SmartPhoneLover)
#### Post date: [October 7, 2023, 11:29am UTC](https://discourse.pi-hole.net/t/api-requests-for-overtimedata10mins-returns-data-not-matching-the-suggested-value-format/65374/3 "2023-10-07T11:29:04Z")

</div>

> (_If that's indeed your expected output, you should check your system's time:  
> `1488150000` translates to Feb 27th 00:00:00 2017 (for a system in CET)._)  
> My system time is correct, no delay is shown on my system.  
> I just put today's time to show an example.

---

<div class="post-metadata">

### Author: ![Bucking\_Horn](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/bucking_horn/32/18719_2.png) [@Bucking\_Horn](https://discourse.pi-hole.net/u/Bucking_Horn)
#### Post date: [October 7, 2023, 11:38am UTC](https://discourse.pi-hole.net/t/api-requests-for-overtimedata10mins-returns-data-not-matching-the-suggested-value-format/65374/4 "2023-10-07T11:38:39Z")

</div>

> [@SmartPhoneLover](#):
>
> Expected output: {"1488150 **000**":xx,"1488150 **600**":xx,"1488151 **200**":xx,(...)}

If 1488150000 is today's time on your system, its clock would be off by more than 5 years.  
Are you sure that's your time?  
What does `date +s%` return on your system?

---

<div class="post-metadata">

### Author: ![SmartPhoneLover](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/smartphonelover/32/37868_2.png) [@SmartPhoneLover](https://discourse.pi-hole.net/u/SmartPhoneLover)
#### Post date: [October 7, 2023, 12:02pm UTC](https://discourse.pi-hole.net/t/api-requests-for-overtimedata10mins-returns-data-not-matching-the-suggested-value-format/65374/5 "2023-10-07T12:02:38Z")

</div>

> [@SmartPhoneLover](#):
>
> - Expected output: {"1488150 **000**":xx,"1488150 **600**":xx,"1488151 **200**":xx,(...)}
> - Actual output: {"1696586 **100**":xx,"1696586 **700**":xx,"1696587 **300**":xx,(...)}

- Expected output: {"1488150 **000**":xx,"1488150 **600**":xx,"1488151 **200**":xx,(...)}, taken from the example of the FAQs page (copy paste). Not my system.
- Actual output: {"1696586 **100**":xx,"1696586 **700**":xx,"1696587 **300**":xx,(...)}, generated from my system.

---

<div class="post-metadata">

### Author: ![rdwebdesign](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/rdwebdesign/32/51363_2.png) [@rdwebdesign](https://discourse.pi-hole.net/u/rdwebdesign)
#### Post date: [October 7, 2023, 4:18pm UTC](https://discourse.pi-hole.net/t/api-requests-for-overtimedata10mins-returns-data-not-matching-the-suggested-value-format/65374/6 "2023-10-07T16:18:24Z")

</div>

> [@Bucking\_Horn](#):
>
> is this intentional, or is the web api calling FTL with an unwanted 5 minutes offset?

This is calculated in FTL, but I think the 5 minutes offset is expected to correctly position the bars on the graph, between two timeslots.

The INTERVAL is 10 minutes. The values are shifted 5 minutes (INTERVAL/2):

> <https://github.com/pi-hole/FTL/blob/1a11413385eee8992b12b662cd37c32e55da4f6d/src/overTime.c#L106-L108>

---

<div class="post-metadata">

### Author: ![rdwebdesign](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/rdwebdesign/32/51363_2.png) [@rdwebdesign](https://discourse.pi-hole.net/u/rdwebdesign)
#### Post date: [October 7, 2023, 4:30pm UTC](https://discourse.pi-hole.net/t/api-requests-for-overtimedata10mins-returns-data-not-matching-the-suggested-value-format/65374/7 "2023-10-07T16:30:18Z")

</div>

Actually, the data from each interval (from 0 to 10 minutes) is aggregated and placed exactly in the middle of the interval.

The point at 00:05 stores data from 00:00 to 00:10.

> [@SmartPhoneLover](#):
>
> taken from the example of the FAQs page (copy paste). Not my system.

This difference is understandable. The FAQ was created many years ago. A lot of changes were made after that. The current output is centering the data, like described above.

---

<div class="post-metadata">

### Author: ![SmartPhoneLover](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/smartphonelover/32/37868_2.png) [@SmartPhoneLover](https://discourse.pi-hole.net/u/SmartPhoneLover)
#### Post date: [October 7, 2023, 9:35pm UTC](https://discourse.pi-hole.net/t/api-requests-for-overtimedata10mins-returns-data-not-matching-the-suggested-value-format/65374/8 "2023-10-07T21:35:42Z")

</div>

Thank you guys for the explanation. I got it now.

---

<div class="post-metadata">

### Author: ![system](https://discourse.pi-hole.net/uploads/default/original/3X/7/c/7c8792f649eeb921c5d2b4c41564ffa873d9a2b8.png) [@system](https://discourse.pi-hole.net/u/system)
#### Post date: [October 14, 2023, 9:35pm UTC](https://discourse.pi-hole.net/t/api-requests-for-overtimedata10mins-returns-data-not-matching-the-suggested-value-format/65374/9 "2023-10-14T21:35:52Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
