Search code examples
curlteamcitycommand-line-interfaceteamcity-rest-api

Create user from teamcity rest API


rest api stated this command as to create user

curl -uadmin:admin -X POST 172.31.68.145:8111/app/rest/users

but it gives user list any suggestion how to create user?


Solution

  • It is because you have not specified any post data for the request.

    Let us take an example:

    curl -H "Content-Type: application/json" -X POST -d '{"username":"xyz","password":"xyz"}' http://localhost:9090/api/login
    

    This will perform a POST request on http://localhost:9090/api/login with the POST data: {"username":"xyz","password":"xyz"} and header for this data is set to: Content-Type: application/json.