...
Where USERNAME, PASSWORD, "teamcity:8111" should be substituted with real values and data.xml file contains data to send to the server.
Examples
Making user a system administrator
1. Enable superuser in REST
create a file <TeamCity Data Directory>\config\internal.properties
with the content:
rest.use.authToken=true
(add the line if the file already exists)
2. Get authToken
restart the TeamCity server and look into <TeamCity home>\logs\teamcity-rest.log
for a line:
Authentication token for superuser generated: 'XXX-YYY-...-ZZZ'.
Copy this "XXX-YYY-...-ZZZ" string. The string is unique for each server restart
3.Issue the request
Get curl command line tool and use a command line:
curl -v --request PUT http://USER:PASSWORD@teamcity:8111/httpAuth/app/rest/users/username:USERNAME/roles/SYSTEM_ADMIN/g/?authToken=XXX-YYY-...-ZZZ
where
"USER" and "PASSWORD" - credentials of a valid TeamCity user (that you can login with)
"teamcity:8111" - TeamCity server URL
"USERNAME" - username of the user to make the system administrator
"XXX-YYY-...-ZZZ" - the authentication token retrieved earlier