Invalid API Key response (Solved)
Greetings!
I recently got into this new management API and managed to authenticate just fine and got my authorization token even.
Then when I tried to for example get list of all of our companies I received an error response which had "Invalid_api_key"
Powershell example below:
Invoke-RestMethod -Method GET -Uri "https://eu1.psb.fsapi.com/mp/v1/partners/370/companies" -Headers $headers -ContentType "application/json"
$headers is a dictionary:
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
X-API-Key with correct key obtained from portal
Authorization with bearer + token from authentication response.
$headers.Add("Authorization","Bearer <insert token here>") $headers.Add("X-API-Key","<insert apikey here>")
and the query returned:
Invoke-RestMethod : {"errors":[{"error":"invalid_api_key"}]}
I tried basically the same code with c# and got 400 bad request.
Something I'm doing wrong here or?
EDIT: I was using a account that had full read permissions but for some reason thats not enough.
I used my personal account in query and it worked fine.
----
Olli Elolähde
Receptum Oy
Comments
-
Hello Olli,
Thank you for the update and glad that it is now sorted out.
0 -
Hi,
> EDIT: I was using a account that had full read permissions but for some reason thats not enough.
> I used my personal account in query and it worked fine.
we have currently a bug that makes it impossible for read-only users to use the management API. Problem is that every API user needs to accept the license terms, but it is impossible to accept them as read-only user currently.
You found one of the work-arounds. Another is to temporarily change the user to be full rights user. Go accept the API terms and then change it back to read-only user.
Proper fix will be coming in couple of releases to this.
Petri
5 -
Alright! Seems fair. We actually changed the user to full rights as it feels more proper than using my own account.
Good that it's being fixed!0
Categories
- All Categories
- 4.6K WithSecure Community
- 3.6K Products
- 1 Get Support