Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matomo getLastVisitDetails with filter_limit = -1 #16107

Closed
gregarious961224 opened this issue Jun 24, 2020 · 3 comments
Closed

Matomo getLastVisitDetails with filter_limit = -1 #16107

gregarious961224 opened this issue Jun 24, 2020 · 3 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@gregarious961224
Copy link

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
Copy link
Member

tsteur commented Jun 24, 2020

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

@tsteur tsteur closed this as completed Jun 24, 2020
@tsteur tsteur added the answered For when a question was asked and we referred to forum or answered it. label Jun 24, 2020
@gregarious961224
Copy link
Author

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
Copy link
Member

tsteur commented Jun 25, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

2 participants