Which are the parameters accepted for agentLocator in REST API Agents Endpoint?

Hello!


I'm trying to retrieve an agent by its name through the http://teamcity:8111/httpAuth/app/rest/agents endpoint but seems like name:<agent_name> is not a valid option for the Agent Locator. I saw an example using the id:<agent_id> but I was unable to find the full list of supported parameters. Could someone point them to me?

Thanks in advance!

3 comments
Comment actions Permalink

Hi Jefferson,

Unfortunately, only "id:XXX" locators are suported for agents in TeamCity 8.0.x.
Next 8.1 EAP will already have support for name:xxx locator.
Do you need support for more?

Out of curiousity, could you describe how you use the API and why you need to find an agent by the name?

0
Comment actions Permalink

Hello Yegor,

We're currently working on automatic provisioning of agents, the idea is to be capable of spining up a new machine, install TeamCity agent, automatically authorize this agent against a TeamCity server and add it to the correct pool.

We got it working but right now we have to do 2 calls for it:

  • The first call get the list of all agents, with the response we pick the Agent Id matching the record with a naming convention based on the fully qualified host name of the machine. (httpAuth/app/rest/agents)
  • Using the Id retrieved in the first call we do a second call to the Authorize endpoint. (httpAuth/app/rest/agents/id:<agent_id>/authorized)


The idea of having a locator by name for agent is that we can avoid the first call.

So, this is great news that it will be supported in next version :)

Thank you,

0
Comment actions Permalink

Thank you for the details!

Do you think a feature would help in your case? The main idea is to allow automatic agent authorization once they provide some "secret" token.

BTW, are your agents based on virtual infrastructure? i.e. is something like support for EC2 applicable for your case?

0

Please sign in to leave a comment.