user create api error
I am currently working on a project in which I need to create user programatically through API.
The endpoint I am using:api/rest/2.0/users/create.
I am getting error while running above endpoint in postman.Details in below section.
header:
X-Requested-By:ThoughtSpot
Content-Type:application/x-www-form-urlencoded
Accept:application/json
Authorization: Bearer QxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxhWnow
request body:{
"name": "name6 tte",
"display_name": "test test",
"email": "[email protected]",
"account_type": "LOCAL_USER",
"account_status": "ACTIVE",
"visibility": "SHARABLE",
"notify_on_share": true,
"show_onboarding_experience": true,
"onboarding_experience_completed": false,
"group_identifiers": [
"1a4xxxxxxxxxxxxxxxxx6f259"
]
}
Error:
{
"error": {
"message": {
"debug": "Variable "$name" of required type "String!" was not provided."
}
}
}
9 Replies
The content-type needs to be "application/json".
Have you tried using the API playground within the dev portal of your instance ? That should create the request in the correct format automatically for you.



I'm not sure about the error message, but you should also need a password. I'm noticing it's not listed as "required", but I believe it is for a local user (else how do they log in).
Also, as @ashish indicated, you do need to make sure the accept/content-type is application/json in the header if it's not.
Also, as @ashish indicated, you do need to make sure the accept/content-type is application/json in the header if it's not.
Content type is json only
I'll try adding password
If error persists I'll reach out here again
Password field is marked as optional.
Reason being, In case of LOCAL_USER password is required and in case of SAML_USER it is optional. Depending on the user_type selected, the API should throw 400 Response code stating password is required field here.
Looks like the response code is correct but the response message is coming as blank which is creating confusion here. We will be fixing the response message in the upcoming release but if we need to back port the fix would you mind logging a support ticket to take it forward.
Sure,just guide me what I have to do
Have you tried adding the password field as @bill_da_golfer suggested and tried the API?
Sample request and response

Yes it's working,thankyou.