Not able to create foreman user from V2 API?

Problem: I am using the foreman V2 API to create the non admin user but it not getting created with these input parameter

 curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -u admin:bgf123# -L -k '{"user":{"login":"john","auth_source_id":1,"password":"ccvfcx","firstname":"John"}},"locations":[{"id":2,"name":"Default Location"}],"default_organization":{"id":1,"name":"Default Organization","title":"Default Organization","description":null},"organizations":[{"id":1,"name":"Default Organization"}],"effective_admin":null}'
  "error": {"id":null,"errors":{"login":["can't be blank"],"auth_source_id":["can't be blank"]},"full_messages":["Username can't be blank","Auth source can't be blank"]}
curl: (3) [globbing] nested braces not supported at pos 9

and not sure what is the wrong syntax or input parameter can some point out what could be the issue.

Expected outcome: user should get created

Foreman and Proxy versions: 1.22

Foreman and Proxy plugin versions: 1.22

Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]
(for logs, surround with three back-ticks to get proper formatting, e.g.)


This is the issue you are hitting, you need to use the -g parameter for curl to disable globbing since otherwise it treats curly braces as special symbols.

You can also see a reference to what parameters are expected by the api in the docs: API documentation or locally on your foreman server at

Hi tbrisker
Thanks for your reply,

here I have figure out the exact syntax to create user using API–below is the curl command

curl -H "Accept:application/json,version=2" -H "Content-Type:application/json" -X POST -u admin:qwe@123# -g -k -d
 '{"admin":false,"auth_source_id":1,"auth_source_name":"Internal","firstname":"john","password":"xxxx","lastname":"Dcosta","locale":null,"locations":[{"name":"LA"}],"roles":[{"name":"Discovery Manager"}],"login":"john","mail":"","organizations":[{"name":"Default Organization"}]}'