Enable trigger using API

Answered

Hi, I am looking the way how to enable trigger. I found example how to disable/enable an artifact dependency.

PUT http://<TeamCity Server host>:<port>/app/rest/buildTypes/<buildTypeLocator>/artifact-dependencies/<id>/disabled


I tried the same for trigger - it is working for disable. But in case of enable - not (in case I added 'enabled' in the end instead of 'disabled')

Is there is a way to enable triggers using API ?
https://www.jetbrains.com/help/teamcity/rest/manage-build-configurations.html

0
2 comments
Avatar
Fedor Rumyantsev

Hello!

Trigger entity does not have "enabled" property, which is why it did not likely work. However, if you would run the request like this:

PUT http://<TeamCity Server host>:<port>/app/rest/buildTypes/<buildTypeLocator>/triggers/<id>/disabled

Headers:
Content-Type: text/plain

Body:
false

then it would set the "disabled" property into false and the trigger would be re-enabled. 
Please let me know if this approach works for you. 

1

Thanks, it helps !

0

Please sign in to leave a comment.