Piwik API returns empty result when period is other than day


#1

Hi,

I’m trying to download customer activity data (customer name is saved in custom variable 2) using Piwik API


https://xxx/piwik/index.php?token_auth=xxx&format=xml&date=yesterday&period=day&idSite=3&module=API&method=CustomVariables.getCustomVariablesValuesFromNameId&idSubtable=2&segment=customVariableValue2==CompanyName

Code above works well, but whenever I try to change period to week, month or something different than day, result is:


<result/>

Any tips?


(Matthieu Aubry) #2

Hi there,

the idSubtable will change for each week / month / year so you need to call again the parent API to get the idSubtable value for the date/idSite/period combination.

Note alternatively you can use &expanded=1 on the API call to request the whole hierarchy