@gregarious961224 opened this Issue on June 24th 2020

Hi guys,

I'm currently attempting to pull out all visit details records that is within any given time frame. I've checked on the web interface that for the given timeframe I've provided in the url: {host_name}/?module=API&method=Live.getLastVisitsDetails&idSite=15&period=range&date=2020-01-25,2020-05-25&segment=dimension2!='null'&format=JSON&filter_limit=-1 there are ~1000 visit details information to pull out. However, when doing this through the API with the same url, we're getting a status code 500 in the response, or if we encapsulate the -1 with "" (i.e. filter_limit="-1") we would only get 10 out of the 1000 visit detail records out. Not too sure whether I've missed something in the developer documents, but from what I can tell, the API url should be correct based on the documents. Any help/guidance would be appreciated.

Cheers,
Greg

@tsteur commented on June 24th 2020 Member

Hey @gregarious961224
you might get an HTTP 500 if you use -1 because the script might time out (it runs too long), or it consumes too much memory. You should in this case use eg

filter_limit=1000&filter_offset=0

then issue another request

filter_limit=2000&filter_offset=1000

And so on. I reckon you get the idea. You might be able to also increment in 10000 steps etc.

And you would stop as soon as you get less results as requested in the filter_limit.

If you have more questions about this feel free to ask in our Platforms forum category: https://forum.matomo.org/c/plugins-platform/11

@gregarious961224 commented on June 25th 2020

Hey @tsteur ,

So I tried out the proposed way of using the filter_limit and filter_offset , but found out that at the end the filter_offset should be the only one incrementing:

1 st request : filter_limit=1000&filter_offset=0
2 nd request : filter_limit=1000&filter_offset=1000
3rd request: filter_limit=1000&filter_offset=2000

And that worked for me, instead of having both the filter_limit incrementing.

@tsteur commented on June 25th 2020 Member

Sorry yes that's correct. Apologies I wasn't thinking it through properly. Thanks for mentioning this.

This Issue was closed on June 24th 2020
Powered by GitHub Issue Mirror