VisualAppeal / Matomo-PHP-API

PHP wrapper for the Matomo API.
MIT License
95 stars 33 forks source link

Malformed requests #8

Closed michaelmohamed closed 9 years ago

michaelmohamed commented 9 years ago

From your code, it seems that the correct way to build a request is like this (from line 2326)

public function getCountryNumber($segment = '') {
    return $this->_request('UserCountry.getNumberOfDistinctCountries', array(
        'segment' => $segment,
    ));
}

;however, there are some functions that use _parseUrl() to generate the first parameter of $this->_request() which causes a malformed request; since the first parameter should be a piwik method name, and not a url. An example would be from line 2650.

public function setUserAccess($userLogin, $access, $idSites) {
    return $this->_request($this->_parseUrl('UsersManager.setUserAccess'), array(
        'userLogin' => $userLogin,
        'access' => $access,
        'idSites' => $idSites,
    ));
}

There are 27 functions that do this in the class. I hope this helps in getting these functions working.