API Help

I am starting out and want to add in API integration to my site. But where is the php class?

I have Piwik installed on a separate server so i need to reference (i think) the API class from my site libs/ folder.

I want to add the class to my site lib/ folder and reference via that so in my controllers i can execute functionality like :

$data = $this->Piwik->getPageUrl ($url, ‘12’, ‘day’, ‘today’, segment = ‘’, ‘format=JSON’);

Just an example to access all the API options available.

Is there a skeleton example of all the available functions in php?



Hello Dave, shortly you need to call APIs objects then handle them in your plugin’s methods.

You can read the entire APIs documentation at this URL: Introduction: API Reference - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3 In your case I bet you need to query the Reporting API.

If you’re working with APIs inside Piwik, for example writing a custom plugin, You could start by shell console with the following command:

./console core:generate plugin

To get helped by console, prepend word help in commands.