I am trying to connect to FreshService via an AP. Everything had been working perfectly, but today I received this message:
{ "code": "access_denied", "message": "You are not authorized to perform this action." }
I can no longer connect through the API. Nothing has changed on the account, but I am wondering if some account settings need refreshing? If this is the case how do I stop this from happening again.
Many thanks
Page 1 / 1
do you definetly have the permissions associated with the API key to perform the transaction
Is the key correct?
Hi Roxwell,
Thanks for coming back to me.
The API key came from an account that has the highest permissions in Fresh Service.
To the best of my knowledge the key is correct. It was working perfectly just the other day. I checked the account and nothing changed. I have recreated the request from scratch with no joy. I'm using PowerAutomate HTTP request.
Can you share the URI you are trying to hit and, if it’s a post/put the body? Be sure to censor anything sensitive while keeping the syntax as is.
Hi Medic,
Thanks for for the help.
I am trying to make a GET request. I have been focusing on establishing a connection first, before diving in to deep. So far, I have been testing by trying to retrieve tickets using the following URI:
https://my domain goes here/api/v2/tickets/[id]
This was working ok at the start of the week.
I attempted to use basic authentication as documented: `APIKey:X`. When that failed, I encoded it with Base64 as suggested in the documentation, but I still received an "access denied" error. I'm quite stuck and unsure of what to do next. I am now questioning if I am missing something simple. Below is an image of the request and the error message.
For your auth, are you using API Key or Basic? Make sure you are using basic auth. While they both “look” the same the headers are different and using API key will cause your requests to error out with the 403.
Hi Medic1334,
Thanks
I am using Basic auth with the following method:
Authorization: ‘Basic MyBase64CodedAuth’
I now get 404 not found, not sure why that is as the URI is correct. Any thought would be much appreciated.
Many thanks
If you use a base64 decoder with your string after Basic (not including the space), what does it give you back? If it’s not your API key with “:X” appended then there’s an issue with your encode and you need to get that figured out and the rest will come.
So far as the URI, something must have changed because your original URL was correct.
Hi Medic 1334,
I believe I have found what is causing the issue. The request requires the URI to include leading and trailing quotes:
'https://MyDomain.com/api/v2/Request'
However, when I add the quotes, the HTTP connector in Power Automate throws an error: "Action HTTP failed." It seems the connector doesn't support leading and trailing quotes. I don’t suppose you know if there is a workaround for this? I've already tried using a compose action and variable, but neither worked.
Everything works as expected when testing in Postman so I now know the end point is correct and basic auth is ok.
Many thanks
Looks like the HTTP action in PA requires a premium license. I would take a look at the headers you are providing and tweak there since you’ve established that the “issue” is power automate (and the format it’s trying to communicate via). Try just authorization in the left block, then Basic (apikey) similar to this. Tweak up the blocks that are setting the headers until you find what works. I cannot find any best practices, etc from PA side on a quick google search.