Piwik API best practice?


#1

I am using curl to fetch data from Piwik. I am using Get requests on piwik (http://example.com/piwik) and am displaying the data on http://example.com/dashboard

Is this the ideal way to do it?
If I make 5 calls to Piwik to load the data on http://example.com/dashboard, the api calls take about 10 seconds, in all, even though the data is almost non-existent.

Is there an alternate to using curl?
Is there an api php wrapper, so I don’t have to make http requests?
What would the best practice be in this case?


#2

I’m using .net, not php, but faced the same issue. I used the bulk api instead, you can send multiple queries in one request and get all the results in one response. Perhaps this is what you need.

http://piwik.org/docs/analytics-api/reference/ and do a Find for the words “Bulk”


#3

For anyone else looking for the answer, for PHP, use this
http://piwik.org/docs/analytics-api/calling-techniques/#toc-call-the-piwik-api-in-php