I’m new to piwik so I suspect that I’ve just missed something simple, but for the life of me I can’t figure out how to get the id of a site from the url.
To reproduce the error, I’ve followed the steps below:
I have set up Piwik on a sandbox domain, example.com/piwiki. The first thing I do is try to get a list of all domains and their ids (just one in this case) so I submit the following url:
http://example.com/piwik/?module=API&method=SitesManager.getAllSitesId&url=example.com&token_auth=xxxxxxxxxxx
This quite happily returns the single domain’s id:
<result>
<row>1</row>
</result>
So now I use SitesManager.getSiteFromId to get the site information:
http://example.com/piwik/?module=API&method=SitesManager.getSiteFromId&idSite=1&token_auth=xxxxxxxxxxx
which returns:
<result>
<row>
<idsite>1</idsite>
<name>example.com</name>
<main_url>http://example.com</main_url>
<ts_created>2011-04-08 04:23:25</ts_created>
<timezone>Australia/Brisbane</timezone>
<currency>USD</currency>
<excluded_ips/>
<excluded_parameters/>
<group/>
<feedburnerName/>
</row>
</result>
Great, now I know that the url of the domain is “http://example.com”, so know I pass this on to SitesManager.getSitesIdFromSiteUrl:
http://example.com/piwik/?module=API&method=SitesManager.getSitesIdFromSiteUrl&url=http://example.com/&token_auth=xxxxxxxxxxx
But this just returns a 404 error! If I set “url” to simply “example.com” I get an empty xml result:
<result/>
What have I missed? I have mod_security enabled, could this have something to do with it?