Trouble with Piwik API URL

Posted this on Stackoverflow and then realised here would be more appropriate.

I’m trying to make an application to get data from the Piwik API to
process and analyse. I’m having trouble getting the API URL to work
properly for our specific site (our Piwik is a multi-site installation,
our site is identified by a segment variable, specifically

(I’ve replaced our domain and token with placeholders)
This URL works fine:

However when I try to access this:

I get this error: <error message="You can't access this resource as it requires an 'view' access for the website id = 3."/> back. The token I am using is definitely correct so I have no idea why it’s coming back with that error.

Any help would be greatly appreciated! :slight_smile:

I think it is your id site which is not the good one. Check it.

Hi @mimzo,

did you find any way to get around this problem? I got the same one, and don’t have a clue what is going wrong.

Thank you a lot!

Hey, thanks for the reply! As far as I know the id site is fine, that’s the one we use to view the data that I’m trying to get. The problem happens when I add the segment in. How am I supposed to find the correct idsite etc for the api url to use?

HI @Billy,

in my case, the problem in my code was the action: “index” in actionToWidgetize. Changing the action to “get” solved the problem.

Seems that not every valid embed in Piwik 2 is valid in Piwik 3. So you should generate new Codes for your widgets, i think.

That worked for me.

Have a nice day!

To see your id site, you mus go to administration icone, and you click on “sites web” on your left

I’m pretty sure the SiteId is NOT the problem. The error message is the same, when getting a non-supported Embed-Type.

Try getting new Embed-Codes. It worked for me.