cancel
Showing results for 
Search instead for 
Did you mean: 

New API, post method not working

New API, post method not working

grech659
New Contributor
Hey guys,

I've been playing around with the new API and absolutely loving it. Big improvement over the old one!

Everything seem to be working great except post methods. For example, I'm trying to grant and external user access following the below documentation.
Swagger UI
Extremecloudiq remove preview
Swagger UI
View this on Extremecloudiq >

I'm using the following URL - https://api.extremecloudiq.com/users/external

Not matter what I put in the body I always get an 400 error as per below.

{
"error_code": "INVALID_ARGUMENT",
"error_id": "b4c66c4cc3284a6dbb66234c17334d5d",
"error_message": "INVALID_ARGUMENT: core.service.invalid.data"
}

I've tried multiple different user accounts but always the same outcome. Any known issues at all?

Any help is much appreciated.

Cheers

Update: Including Raw Output with username replaced.

POST /users/external HTTP/1.1
Authorization: Bearer [Placeholder token]
Host: api.extremecloudiq.com
Content-Type: application/json
Content-Length: 116

{
"login_name": "xxxx.xxxx@xxxx.nz",
"user_role": "ADMINISTRATOR",
"enable_api_access": "true"
}
7 REPLIES 7

grech659
New Contributor
So I've done a bit more testing. This can be replicated in swagger by following:

Testing a local account(Works)
POST /login - with local username and password
Set authorization token to result of above
POST /users/external - successfully added external user

Testing on external admin(Doesn't work)
POST /login - with the external admins username and password
Set authorization token to result of above
GET /account/external - to get a list of available instances to switch to
POST /account/:switch?id=<id from above GET method>
Update authorization token to result of above so its authorized to the new instance
POST /users/external - Error 400 - doesn't seem exclusive to just the POST /user/external method as well. Seems most post methods dont work

Running /auth/permissions on the new access token generated by POST /account/:switch show all the same permissions as the token generated by local account. Same with running POST /auth/permissions/:check and passing it the POST /user/external method you get code 200 back showing you do have the permissions for it.

So seems like a bug?

grech659
New Contributor
That is exactly what I'm currently doing. This issue seems to be that the access token generated by the /account/:switch method isnt allowing me to post anything to the new context which is causing the error below.

{
"error_code": "INVALID_ARGUMENT",
"error_id": "b4c66c4cc3284a6dbb66234c17334d5d",
"error_message": "INVALID_ARGUMENT: core.service.invalid.data"
}

If I swap the access token(and not touch the body) out for one that was generated by a local admin account then it works perfectly fine.

Kurt_Semba
Extreme Employee
When you authenticate to the XIQ API you get logged into your "main" account. This is the account in which are a a normal admin and not an "external admin". Using that authentication token, you should be able to make all API calls in your main account. 

If you want to then make API calls in a different account in which you have been added as "external admin" you will first have to switch to that account. You can use /account/external to list all account IDs that you are able to switch to. Then use /account/:switch to actually switch your context to this account (you will get a new token to use for subsequent calls).

grech659
New Contributor
Sorry, not guest admin. I mean external admin 🙂
GTM-P2G8KFN