Method | Description | |
---|---|---|
__construct ( string | array $request = null, array $defaultRequest = null ) | Constructor. | |
getBaseReportUrl ( string $module, string $action, array $queryParams = [] ) : string | Returns the URL for the current requested report w/o any filter parameters. | |
getClassNameAPI ( string $plugin ) : string | Returns the name of a plugin's API class by plugin name. | |
getCurrentUrlWithoutGenericFilters ( array $params ) : string | Returns the current URL without generic filter query parameters. | |
getRawSegmentFromRequest ( ) : array | boolean | Returns the segment query parameter from the original request, without modifications. | |
getRenamedModuleAndAction ( $module, $action ) : array( | For backward compatibility: Piwik API still works if module=Referers, we rewrite to correct renamed plugin: Referrers | |
getRequestArrayFromString ( string | array | null $request, array $defaultRequest = null ) : array | Converts the supplied request string into an array of query paramater name/value mappings. The current query parameters (everything in $_GET and $_POST) are forwarded to request array before it is returned. | |
getRequestParametersGET ( ) : array | Returns the original request parameters in the current query string as an array mapping query parameter names with values. The result of this function will not be affected by any modifications to $_GET and will not include parameters in $_POST. | |
isApiRequest ( array $request ) : boolean | Detect if request is an API request. Meaning the module is 'API' and an API method having a valid format was specified. | |
process ( ) : |
Dispatches the API request to the appropriate API method and returns the result after post-processing. | |
processRequest ( string $method, array $paramOverride = [], array $defaultRequest = null ) : mixed | Helper method that processes an API request in one line using the variables in $_GET and $_POST. | |
reloadAuthUsingTokenAuth ( array $request = null ) : void | If the token_auth is found in the $request parameter, the current session will be authenticated using this token_auth. | |
shouldLoadExpanded ( ) : boolean | Returns whether the DataTable result will have to be expanded for the current request before rendering. | |
shouldLoadFlatten ( ) : boolean |
Method | Description | |
---|---|---|
extractModuleAndMethod ( string $parameter ) : array | Returns array($class, $method) from the given string $class.$method | |
forceReloadAuthUsingTokenAuth ( string $tokenAuth ) : void | The current session will be authenticated using this token_auth. | |
getDefaultRequest ( ) : array | ||
renameModuleAndActionInRequest ( ) | ||
restoreAuthUsingTokenAuth ( $tokenToRestore, $hadSuperUserAccess ) | ||
sanitizeRequest ( ) | Make sure that the request contains no logical errors | |
shouldReloadAuthUsingTokenAuth ( $request ) |
public __construct ( string | array $request = null, array $defaultRequest = null ) | ||
$request | string | array | Query string that defines the API call (must at least contain a **method** parameter), eg, `'method=UserLanguage.getLanguage&idSite=1&date=yesterday&period=week&format=xml'` If a request is not provided, then we use the values in the `$_GET` and `$_POST` superglobals. |
$defaultRequest | array | Default query parameters. If a query parameter is absent in `$request`, it will be loaded from this. Defaults to `$_GET + $_POST`. |
public static getClassNameAPI ( string $plugin ) : string | ||
$plugin | string | The plugin name, eg, `'Referrers'`. |
return | string | The fully qualified API class name, eg, `'\Piwik\Plugins\Referrers\API'`. |
public static getCurrentUrlWithoutGenericFilters ( array $params ) : string | ||
$params | array | Query parameter values to override in the new URL. |
return | string |
public static getRawSegmentFromRequest ( ) : array | boolean | ||
return | array | boolean |
public static getRenamedModuleAndAction ( $module, $action ) : array( | ||
$module | ||
$action | ||
return | array( |
public static getRequestArrayFromString ( string | array | null $request, array $defaultRequest = null ) : array | ||
$request | string | array | null | The base request string or array, eg, `'module=UserLanguage&action=getLanguage'`. |
$defaultRequest | array | Default query parameters. If a query parameter is absent in `$request`, it will be loaded from this. Defaults to `$_GET + $_POST`. |
return | array |
public static getRequestParametersGET ( ) : array | ||
return | array |
public static isApiRequest ( array $request ) : boolean | ||
$request | array | eg array('module' => 'API', 'method' => 'Test.getMethod') |
return | boolean |
public static processRequest ( string $method, array $paramOverride = [], array $defaultRequest = null ) : mixed | ||
$method | string | The API method to call, ie, `'Actions.getPageTitles'`. |
$paramOverride | array | The parameter name-value pairs to use instead of what's in `$_GET` & `$_POST`. |
$defaultRequest | array | Default query parameters. If a query parameter is absent in `$request`, it will be loaded from this. Defaults to `$_GET + $_POST`. To avoid using any parameters from $_GET or $_POST, set this to an empty `array()`. |
return | mixed | The result of the API request. See {@link process()}. |
public static reloadAuthUsingTokenAuth ( array $request = null ) : void | ||
$request | array | If null, uses the default request ($_GET) |
return | void |
public static shouldLoadExpanded ( ) : boolean | ||
return | boolean |
public static shouldLoadFlatten ( ) : boolean | ||
return | boolean |