in TeamCity 7.0, it will be possible to enable/disable agent by sending true/false via PUT request to http://<teamcity_server_url>/httpAuth/app/rest/agents/<agentLocator>/enabled
Hi, I'm trying to take advantage of this feature on TeamCity 7.03 and although I can get the api to tell me if a given server is enabled or not, I can't craft the put request to disable it, can you be a little more specific on how to do this please? I figure I'm doing something a little daft, but I can't for the life of me work it out.
With curl that would be curl -v --basic --user USERNAME:PASSWORD --request PUT "http://teamcity/httpAuth/app/rest/agents/id:3/enabled" --data false --header "Content-Type: text/plain" for disabling the agent, and curl -v --basic --user USERNAME:PASSWORD --request PUT "http://teamcity/httpAuth/app/rest/agents/id:3/enabled" --data true --header "Content-Type: text/plain" for enabling.
It seems my problem is due to a template configuration having the agent definition. If I try to change the agent for the build that inherits from the template I get an 'requirement for parameter with name 'projectTypes' already exists.' If I detatch it from the template then is works.
You seem to try to modify agent requirements, which is a bit different thing from agent enabling/disabling, so this might deserve a different thread. The message you receive is most probably the same you would get if you try to do that from UI.
There is no such feature yet, but you can make HTTP call as explained in this thread.
We have this feature request in TW-8394, please vote.
Hello Tennis,
in TeamCity 7.0, it will be possible to enable/disable agent by sending true/false via PUT request to http://<teamcity_server_url>/httpAuth/app/rest/agents/<agentLocator>/enabled
Hi, I'm trying to take advantage of this feature on TeamCity 7.03 and although I can get the api to tell me if a given server is enabled or not, I can't craft the put request to disable it, can you be a little more specific on how to do this please? I figure I'm doing something a little daft, but I can't for the life of me work it out.
This tells me if the agent id 3 is enabled:
http://teamcity/httpAuth/app/rest/agents/id:3/enabled
And I get true if it is and false if it's not. What I want to do is set it, not get it.
Thanks, Jeremy.
Jeremy,
With curl that would be
curl -v --basic --user USERNAME:PASSWORD --request PUT "http://teamcity/httpAuth/app/rest/agents/id:3/enabled" --data false --header "Content-Type: text/plain"
for disabling the agent, and
curl -v --basic --user USERNAME:PASSWORD --request PUT "http://teamcity/httpAuth/app/rest/agents/id:3/enabled" --data true --header "Content-Type: text/plain"
for enabling.
It seems my problem is due to a template configuration having the agent definition. If I try to change the agent for the build that inherits from the template I get an 'requirement for parameter with name 'projectTypes' already exists.' If I detatch it from the template then is works.
You seem to try to modify agent requirements, which is a bit different thing from agent enabling/disabling, so this might deserve a different thread. The message you receive is most probably the same you would get if you try to do that from UI.
Sorry posted in wrong thread, will update original.
http://devnet.jetbrains.net/message/5466350#5466350
Is there a way to set the disable/enable reason through the REST api?
Please watch/vote for this feature request. Current workaround is to perform the request to the server like browser does: