Piwik\Plugins\API\Controller::index PHP Method

index() public method

public index ( )
    function index()
    {
        $token = 'token_auth=' . Common::getRequestVar('token_auth', 'anonymous', 'string');
        // when calling the API through http, we limit the number of returned results
        if (!isset($_GET['filter_limit'])) {
            if (isset($_POST['filter_limit'])) {
                $_GET['filter_limit'] = $_POST['filter_limit'];
            } else {
                $_GET['filter_limit'] = Config::getInstance()->General['API_datatable_default_limit'];
            }
        }
        $request = new Request($token);
        $response = $request->process();
        if (is_array($response)) {
            $response = var_export($response, true);
        }
        return $response;
    }