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

Make it more clear in Reporting API reference that by default only 100 rows are returned #11772

Closed
elpendor opened this issue Jun 7, 2017 · 2 comments
Assignees
Labels
c: Website matomo.org For issues related to our matomo.org website.
Milestone

Comments

@elpendor
Copy link

elpendor commented Jun 7, 2017

I have a site with recorded logs back from 2016.

The following API request only returns results from 2017, when it should include those from 2016 as well:
https://mypiwikinstance/?module=API&method=Live.getLastVisitsDetails&idSite=xx&token_auth=xxxxxxxxxxxxxxx&period=range&date=2016-01-01,2017-12-12

These will return the correct values from the respective year:

https://mypiwikinstance/?module=API&method=Live.getLastVisitsDetails&idSite=xx&token_auth=xxxxxxxxxxxxxxx&period=year&date=2016-01-01

(I get results from 2016)

https://mypiwikinstance/?module=API&method=Live.getLastVisitsDetails&idSite=xx&token_auth=xxxxxxxxxxxxxxx&period=year&date=2017-01-01

(I get results from 2017)

I've reproduced it on 2 different piwik instances. Am I missing something here? "Range" seems to be working fine on other API methods.

The visitor log from the dashboard, on the other hand, seems to be returning the correct results. I don't know exactly if these use the same endpoint to obtain data.

If it's any help, I've already run the archiving process to process all those logs.

Any ideas?

@RMastop
Copy link
Contributor

RMastop commented Jun 7, 2017

Hi @elpendor,

By default Piwik only returns a partial dataset (100). By using the filter_limit and filter_offset you can get remaining items.

for instance
https://mypiwikinstance/?module=API&method=Live.getLastVisitsDetails&idSite=xx&token_auth=xxxxxxxxxxxxxxx&period=range&date=2016-01-01,2017-12-12&filter_limit=100&filter_offset=0
will get you the 100 most recent records in the selected range,
Where https://mypiwikinstance/?module=API&method=Live.getLastVisitsDetails&idSite=xx&token_auth=xxxxxxxxxxxxxxx&period=range&date=2016-01-01,2017-12-12&filter_limit=100&filter_offset=100 will get you the next batch of 100 records.
By adjusting the integers, you can get larger or smaller datasets.

Cheers,
Richard

@elpendor
Copy link
Author

elpendor commented Jun 7, 2017

Huh, my bad. I completely missed that part of the documentation.

Thanks, that was it. Working perfect now. I'll close the issue.

@elpendor elpendor closed this as completed Jun 7, 2017
@mattab mattab added the answered For when a question was asked and we referred to forum or answered it. label Jun 21, 2017
@mattab mattab changed the title Live.getLastVisitsDetails period "range" returning incorrects results Make it more clear in Reporting API reference that by default only 100 rows are returned Jun 21, 2017
@mattab mattab added c: Website matomo.org For issues related to our matomo.org website. and removed answered For when a question was asked and we referred to forum or answered it. labels Jun 21, 2017
@mattab mattab added this to the 3.0.5 milestone Jun 21, 2017
@mattab mattab self-assigned this Jun 21, 2017
@mattab mattab reopened this Jun 21, 2017
@mattab mattab modified the milestones: 3.1.0, 3.0.5 Jul 24, 2017
@mattab mattab modified the milestones: 3.5.0, 3.4.0 Mar 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Website matomo.org For issues related to our matomo.org website.
Projects
None yet
Development

No branches or pull requests

3 participants