TeamCity 2020.2 Help

Curl Examples

This article contains REST API examples for curl.

You can use the curl command-line tool to interact with the TeamCity REST API.

Example command:

curl -v --basic --user USERNAME:PASSWORD --request POST "http://<TeamCity Server host>:<port>/app/rest/users/" --data @data.xml --header "Content-Type: application/xml"

where USERNAME, PASSWORD, <TeamCity Server host>:<port> are to be substituted with real values, and data.xml file contains the data to send to the server.

Creating a new project

Using curl tool:

curl -v -u USER:PASSWORD http://<TeamCity Server host>:<port>/app/rest/projects --header "Content-Type: application/xml" --data-binary "<newProjectDescription name='New Project Name' id='newProjectId'><parentProject locator='id:project1'/></newProjectDescription>"

Making user a system administrator

  1. Get super user token.

  2. Issue the request.

  3. Get curl command line tool and use a command line:

curl -v -u :SUPERUSER_TOKEN --request PUT http://<TeamCity Server host>:<port>/app/rest/users/username:USERNAME/roles/SYSTEM_ADMIN/g/

where SUPERUSER_TOKEN is the super user token unique for each server start; <TeamCity Server host>:<port> — the TeamCity server URL; USERNAME — the username of the user to be made the system administrator.

Last modified: 20 February 2021