Empty response for a specific API date range


#1

Hi All,

We are putting together a simple report web page for our users, just showing the last 3 months’ trend for Page Views and Time Spent on Page.

I’m having a problem with the following API string:
http://servernamehere/stats/piwik/index.php?module=API&method=Actions.getPageTitles&filter_pattern=ProdOps&idSite=2&period=range&date=2014-05-01,2014-05-31&format=JSON&token_auth=tokenhere

I was getting valid responses until last Thursday for May, June, and July’s API requests. Thursday morning, we started getting an empty (invalid) response for the May statistics requests. I could change the end date from May 31 to the 30th, 29th, etc. and get a valid JSON in response. Friday night, this May 1-31 range started working and giving me a valid response again.

I thought that was the end of the mystery. However, now that it’s September and the last 3 months are June, July, and August. The July 1-31 API request is getting an empty response, when it had been working fine previously. Even plugging the API request into a browser, we see an empty response. Here’s our July query:

http://servernamehere/stats/piwik/index.php?module=API&method=Actions.getPageTitles&filter_pattern=ProdOps&idSite=2&period=range&date=2014-07-01,2014-07-31&format=JSON&token_auth=tokenhere

And once again, if I change the date range even a little bit, we get a valid response.

We are on Piwik 1.12 - and we can’t upgrade just yet because another application on the server has a dependency on the older PHP version currently running. [Also - the reason we are using a date range is because period=month&date=previousn (I could be wrong about the specific syntax - I’m going from memory) doesn’t work on our version of Piwik, but I have found a report that it is fixed in a newer version. Using a date range is our workaround for now.]

Any idea what could be causing my issue with the intermittent blank response or any suggestions on what to try as a workaround?

Thank you very much,
Amy


(Matthieu Aubry) #2

Do you see any error in your error logs ?


#3

Hi Matt,

With more experimentation, I’ve found that http://servernamehere/stats/piwik/index.php?module=API&method=Actions.getPageTitles&filter_pattern=ProdOps&idSite=2&period=month&date=2014-07-01&format=JSON&token_auth=tokenhere replies with a valid JSON even though specifying July’s dates with period=range is still failing. This is an acceptable workaround for us, so I’m not going to pursue further troubleshooting the range problem at this time.

As an aside, the only similarity between May’s and July’s date ranges (our intermittently failing ranges) is that they both are months with 31 days. That may not be relevant, but just wanted to make a note of it in case anyone else were to be seeing a similar problem.

Thanks!
-Amy


(Matthieu Aubry) #4

Maybe you can try with Piwik 2.6.1 and see if problem is fixed ?


#5

Wish I could! But there is an app from a different team on this server that relies on an older version of PHP, so we can’t upgrade Piwik until we can upgrade PHP. We have been in negotiations about a PHP upgrade for quite a while, so I have no guess as to when this might happen.

Thanks so much,
Amy