TeamCity 2021.1 Help

Manage Agent Pools

This article lists REST API requests concerning agent pools.

Get Agent Pools

To get a list of all agent pools, use:

GET http://<TeamCity Server host>:<port>/app/rest/agentPools

The request responds with an AgentPools entity which contains instances of an AgentPool entity. The request accepts locator parameter which should be typed as AgentPoolLocator.

For example, to get a pool named MyPool, use:

GET http://<TeamCity Server host>:<port>/app/rest/agentPools/name:MyPool

Create Agent Pool

To create an empty pool, POST an empty AgentPool entity to:

POST http://<TeamCity Server host>:<port>/app/rest/agentPools

Example payload:

<agentPool name="string"/>
{ "name" : "name" }

Update Agent Pool

To update an existing pool, PUT an updated AgentPool to this endpoint:

PUT http://<TeamCity Server host>:<port>/app/rest/agentPools/<agentPoolLocator>

Delete Agent Pool

To delete an agent pool, send DELETE to this endpoint:

DELETE http://<TeamCity Server host>:<port>/app/rest/agentPools/<agentPoolLocator>

Manage Agents Within Agent Pool

To move agent to a given pool, POST an Agent entity to this endpoint:

POST http://<TeamCity Server host>:<port>/app/rest/agentPools/<agentPoolLocator>/agents

Example payload (this will move the agent with the ID 1 to the given pool):

<agent id="1"/>
{ "id" : "1" }

Manage Projects Associated with Pool

To associate a project with a given pool, POST a Project entity to the below endpoint:

POST http://<TeamCity Server host>:<port>/app/rest/agentPools/<agentPoolLocator>/projects

Example payload (this will move project with the ID MyProject to the given pool):

<project id="MyProject"/>
{ "id" : "MyProject" }

To remove a project from a pool, use:

DELETE http://<TeamCity Server host>:<port>/app/rest/agentPools/<agentPoolLocator>/projects/<projectLocator>

projectLocator is typed as ProjectLocator.

Last modified: 14 October 2021