API question getPageUrl and getPageUrls


#1

hello,
I’m trying to build a small list of Intranet pages with the linked statistic values. I try to use either gepPageUrl or getPageUrls.
I have the following problem: in piwik when I list all the pages for a site I have first 2 entries and when I click on + it opens more pages and informations.
But when I use the API getPageUrl, I only see the 2 items of the beginning. I cannot access all the other pages.
getPageUrls only allow access to the pages available in the getPageUrl list…

For one site (the Intranet portal) it works.

Any idea why I have this behaviour and what must be changed in order to have all the pages in the getPageUrl?

thanks
Jérôme


(Matthieu Aubry) #2

Sorry I dont undersatnd. What exactly is the problem?

Please put

  • Request API URL used
  • Output obtained
  • Output you expected

#3

hello, here is more information, based on the printscreen in the original post

REQUEST:
http://intranet/piwik/?module=API&method=Actions.getPageUrls&idSite=3&period=year&date=yesterday&format=xml&token_auth=xxx

Output:


/adifi
<nb_visits>377</nb_visits>
<nb_hits>416</nb_hits>



adifi
<nb_visits>176</nb_visits>
<nb_hits>198</nb_hits>


so only 2 results, as I have on the action - pages in Piwik. But actually they are more than 2 pages in this sites, as we can see in the second printscreen.
I expect 20 results

And thus if I use the getPageUrl with an existing page, who is not listed in the getPageUrls I have an empty result

REQUEST:
http://intranet/piwik/?module=API&method=Actions.getPageUrl&pageUrl=/adifi_project&idSite=3&period=year&date=yesterday&format=xml&token_auth=xxx

Output:

Expected:


/adifi_project
<nb_visits>7</nb_visits>
<nb_hits>8</nb_hits>



(Matthieu Aubry) #4
  1. try &expanded=1 to return all data (or use the latest RC from Index of / and try &flat=1 )
  2. there is no page /adifi_project in the report so it will not work? there is /adifi/adifi-home/adifi-project you have to specify the full path to getPageUrl

#5

hello.

thank you, that’s it. I need to specify the full path to access a single URL directly.

I have to change some part of my code to implement this, but I think I have what I need now.

thanks a lot for the answers.

Jérôme