API Actions.getDownloads Request problem


#1

Hello,

I am not actually sure if it’s me or if the update (either 1.4 or 1.5) broke it.

I have a domain (mysterytwisterc3.org) which has several subdomains and I wanted to get file download stats. For one domain this was easy, for multiple domains not so much but I figured it out be reverse building the request which is sent when you go into Piwik -> Actions -> Downloads and enter a search. (Note: all described steps were taking at least two updates ago, on 1.3 I believe)

The request was this:
?filter_only_display_idgoal=-1&filter_sort_order=desc&filter_offset=0&module=Actions&action=getDownloads&idSite=1&period=range&date=2010-10-01%2C2011-07-01&enable_sort=1&filter_sort_column=nb_visits&filter_limit=100&search_recursive=1&viewDataTable=table&controllerActionCalledWhenRequestSubTable=getDownloadsSubDataTable&totalRows=17&filter_column_recursive=label&filter_pattern_recursive=mtc3-

I then modified it to fit the API. First I removed every bit of parameter which didnt alter the information I got. When I had only the information I needed (removing filter_limit, sort and so on) in the request, I made it a API request (I think by just exchanging method and module parameters and I finally had this request:

?module=API&method=Actions.getDownloads&idSite=1&period=year&date=2011-07-01&search_recursive=1&filter_column_recursive=label&filter_pattern_recursive=mtc3-&token_auth=blabla

And it worked perfectly! I used this request via the PHP API (including necessary files and so on). I unserialized the response and used the data.

Now I see it doesn’t work anymore and I can’t get it to work.
Note: My Request in PHP also included the format=php parameter which I omitted above.

In case there are any questions: The day I did this, I also documented this on my blog so if I am unclear or not very accurate, this can also be found here: http://javex0.wordpress.com/2011/06/09/getting-file-downloads-from-the-piwik-api-in-phpjoomla/

So everything went fine. But since 1.4 (I think) it does not work any more. I thought this might be a problem on the software’s side since the examples don’t seem to work either:
http://piwik.org/docs/analytics-api/reference/
Actions.getDownloads examples all return nothing ( for example) while others seem to still work.

Oh and my final PHP function looks like this:


function piwikRequest($method = "", $idSite = 1, $date = "", $period = "", $additional_params = "")
	{
		$token = $this->piwik_token;
		// This inits the API Request with the specified parameters
		$request = new Piwik_API_Request("
			method=$method
			&idSite=$idSite
			&date=$date
			&period=$period
			&format=php
			&token_auth=$token
			&$additional_params
		");
		return unserialize($request->process());
	}

With this being a typical call:


$this->piwikRequest('Actions.getDownloads', 1, $date, "range", 
			"search_recursive=1&
			filter_column_recursive=label&
			filter_pattern_recursive=mtc3-")

$date is correctly formatted being a start date and the current day built by php. The filter_pattern is for the filename: All files start with this so I only search for those files.

So this is basically it. It used to work and now it doesn’t which I find pretty confusing since I don’t remember changing anything.

I hope someone can clear this a bit for me.