getOutlink api call no results -> getOutlinks working


#1

I used the API call to add a real website not show in the example here. My control Panel shows Name = http://anothersite.com URL = another.com

I beleive I enterd no alias into the add site call.

I can make the call successfully to the 2 outlinks I created throught the javascript tracking mechanism by clicking them on my site.

Here is the API call for Outlinks that works perfect:
http://example.com/piwik/?module=API&token_auth=6075ebc0af5d099a34a7447f10089119&method=Actions.getOutlinks&idSite=9&period=day&date=today

PROBLEM
Here are my attempted failed calls to the Actions.getOutlink and only shows <result,/> tag.

http://www.example.com/piwik/?module=API&token_auth=6075ebc0af5d099a34a7447f10089119&method=Actions.getOutlink&idSite=9&outlinkUrl=another.com&period=day&date=today&format=xml

http://www.example.com/piwik/?module=API&token_auth=6075ebc0af5d099a34a7447f10089119&method=Actions.getOutlink&idSite=9&outlinkUrl=http://anothersite.com&period=day&date=today&format=xml

For the life of me I don’t understand why there is no way to parse throught the XML results for the getOutlinks call and then use the 7 tag to bring the missing uri / query data attached to that id??? Or maybe there is?

Any help would be super appreciated…


#2

For those who want to call getOutlink by idSubtable, I made a simple change. I couldn’t get mine to function with the call to outlinkUrl, but I found that clunky anyway and preferred the using idSubtable.

folder piwik/plugins/Actions/API.php

File to mod is API.php

Change to lines (close to lines 260):

ORIGINAL

// public function getOutlink($outlinkUrl, $idSite, $period, $date, $segment = false)
// {
// $callBackParameters = array(‘Actions_outlink’, $idSite, $period, $date, $segment, $expanded = false, $idSubtable = false);
// $dataTable = $this->getFilterPageDatatableSearch($callBackParameters, $outlinkUrl, Action::TYPE_OUTLINK);
// $this->filterActionsDataTable($dataTable);
// return $dataTable;
// }

MODIFIED (remove $outlinkUrl add $idSubtable where bolded)

public function getOutlink($idSite, $period, $date, $segment = false,[b]$idSubtable[/b])
{
    $callBackParameters = array('Actions_outlink', $idSite, $period, $date, $segment, $expanded = false, [b]$idSubtable[/b]);
    $dataTable = $this->getFilterPageDatatableSearch($callBackParameters, [b]$idSubtable[/b], Action::TYPE_OUTLINK);
    $this->filterActionsDataTable($dataTable);
    return $dataTable;
}

(Matthieu Aubry) #3

You don’t need to change the code, you should use instead the API Actions.getOutlinks with the idSubtable. This should work?


#4

Yes, I see you already had that set up, and I myself should have realized that in your code.

I replaced your original code and will now use getOutlinks with idSubtable.

I must still make 2 calls, one to parse all the XML in the first call to getOutlinks to gather the idSubtables in an array and then make the call to back to getOulinks with the idSubtable in order to caputre the full .

If there is a better way to do this, please let me know. The real problem is that the full isn’t included with the original call to getOulinks. This would eliminate the whole 2 call issue and a lot of extra scripting…


(Matthieu Aubry) #5

you can try to add &flat=1

and / or &expanded=1


#6

Hi Matt,

Thanks a mil!! The flat=1 worked great. I can put this post to rest…

Best,
Mike