Request unlimited number of a sites from matomo

By default, matomo applies a limit of 100 results to all API endpoints
that return an array. By passing filter_limit -1 all results can be
fetched in a single call for the site lists.

Ref: https://developer.matomo.org/api-reference/reporting-api
This commit is contained in:
Kienan Stewart 2019-04-05 13:37:01 -04:00
parent 5a62d13843
commit 0956906e98
No known key found for this signature in database
GPG Key ID: 075A846E78FE47EA
1 changed files with 4 additions and 2 deletions

View File

@ -326,7 +326,8 @@ class m_piwik {
$msg->debug("piwik","site_list"); $msg->debug("piwik","site_list");
$this->get_alternc_sites(); $this->get_alternc_sites();
$api_data = $this->call_privileged_page('API', 'SitesManager.getAllSites'); $api_data = $this->call_privileged_page('API', 'SitesManager.getAllSites',
array('filter_limit' => -1));
$data = array(); $data = array();
if($api_data) { if($api_data) {
@ -364,7 +365,8 @@ class m_piwik {
function get_site_list() function get_site_list()
{ {
return $this->call_privileged_page('API', 'SitesManager.getAllSites'); return $this->call_privileged_page('API', 'SitesManager.getAllSites',
array('filter_limit' => -1));
} }
// Ajoute un site à Piwik // Ajoute un site à Piwik
// can't figure out how to pass multiple url through the API // can't figure out how to pass multiple url through the API