cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting error 422 Unprocessable Entity when I try create a user using 1.5 api

Hello,

I'm getting error 500 when I try create a user using https://reference.rightscale.com/api1.5/resources/ResourceUsers.html#create

Calling the API using Powershell's Invoke-WebRequest

Uri: https://us-3.rightscale.com/api/users

Method: Post

Headers: 1) Authorization Bearer <access_token>

  2) X_API_VERSION 1.5 

ContentType: application/json

Body: {
"user": {
"first_name": "Elizabeth",
"last_name": "Marion Test",
"company": "QAD Inc.",
"email": "eam.tst@qad.com",
"phone": "+1.805.566.6000",
"identity_provider_href": "/api/identity_providers/671",
"principal_uid": "S-1-5-21-2079806146-870401579-1458450816-114870"
}
}

The error message I'm getting is

[2022-03-25 06:14:24] Error creating new RightScale user: eam.tst@qad.com! Invoke-WebRequest : The remote server returned an error: (422) Unprocessable Entity.
At C:\RS Admin Scripts\User Account Management\RightScale_Group_Sync.ps1:255 char:26
+ ... serResult = Invoke-WebRequest -UseBasicParsing -Uri "https://$RSHost/ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

 

Can you help me identify what's wrong with this call - or what the 'Unprocessable Entity' is.

thanks,

Denis

 

(2) Replies

@dvrqad 

I can see that you're working with support and engineering on getting this issue resolved, so hopefully it will quickly... Please update the community with its resolution if you think other members could benefit from it afterwards.

Thanks,

I received a response from support identifying the issue is that there is another record in the system with the same principal_uid.

Case #02558217