Reporting API date range problem

HI, I have a strange problem with the reporting API calls using range dates:
If I look for quarterly data using the following call
https:///index.php?module=API&method=Events.getAction&idSite=7&date=2022-04-01,2022-06-30&period=range&token_auth= the call returns nothing, but if I use
https:///index.php?module=API&method=Events.getAction&idSite=7&date=2022-04-01,2022-06-29&period=range&token_auth= or
https:///index.php?module=API&method=Events.getAction&idSite=7&date=2022-04-01,2022-06-31&period=range&token_auth= it returns the correct numbers.

This happens to any quarter and any year.

How am I supposed to look for quarterly data?

Can you check this (bad) behavior on the demo site:
(no need of a token_auth)
If this (bad) behaviour is still there, you can create an issue at:

Hi Philippe,
Thank you very much for your prompt response.

In order for me to make an API call I need to provide site Id Usually the site id is found by going to

but I do not see the Websites menu item on the demo website

How can I find site id on the Matomo demo site?

Thank you.

Here is what I see on the Matomo demo site

In the demo site, idsite=1

Hi Philippe,

Again, thank you for your prompt response. Of course, it works fine on the demo website. The only thing that I found odd on my Matomo installation and the demo website. Is that it allows using non-exiting dates in the date range parameter. Here I used 06/31/2022 and got results

The strange behavior I observe on my Matomo installation is that one day the same API calls return that expected data, and the next day they do not.

For example, on 04/26/2022 the calls,2022-06-30&period=range&token_auth=

and the previous call with date=2022-04-01,2022-06-29
returned nothing
the call,2022-06-28&period=range&token_auth=
returned the data for the second quarter
but today all calls listed above return the data for the second quarter as expected.

Any suggestions how to troubleshoot this are greatly appreciated.

Thank you.

How do you archive data?
Archiving process is used to compile data used by reports:

Hi Philippe,

Here is how my archiving options are set:

How do the data need to be archived in order for me to get correct results every day using API calls?

Thank you.

Do you know if you have a CRON (or task scheduler) that archive Matomo data?
Also coming back to your initial issue, do you see some error in the Matomo log (eg. timeout, etc.)?

Yes, I do have a CRON job that runs every hour.
And no, I do not have any errors in the Matomo log when the request returns an empty set.

@innocraft any idea?

It’s likely here that your server is either running out of Memory or you’re just hitting a time out for the request. The reason it doesn’t work one day and works the next is because the server keeps trying to process the data even after the request times out.

You will likely need to increase the max_execution_time in your PHP.ini
You also probably won’t see an error in your Matomo logs but you might see the error in your PHP error logs.

Locate your php.ini file. Once you’ve located the php.ini file, look for the following line:

; Maximum execution time of each script, in seconds
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 30

Increase it as you see fit. For large Matomo instances, we recommend setting it to 0; this sets it to limitless.

Remember to restart your web server.