How to get trigger configuration with rest api?

Answered

Hey. I`m trying to get buildType id of a task that triggers another task, no luck so far.

Say, I have a task "someProject_SomeTask" that is triggered after another task is finished. And I need to get an id of the task that triggers it.  If I use a query like this:

GET https://teamcity.mycompany.com/app/rest/buildTypes/someProject_SomeTask/triggers/

I get a response like that:

{
"count": 1,
"trigger": [
{
"id": "DelayedFinishedBuildTrigger",
"type": "DelayedFinishedBuildTrigger",
"properties": {
"count": 3,
"property": [
{
"name": "afterSuccessfulBuildOnly",
"value": "true"
},
{
"name": "trigger_configuration",
"value": "bt12345"
},
{
"name": "wait_time",
"value": "1"
}
]
}
}
]
}

The only clue what task triggers "someProject_SomeTask" is "trigger_configuration=bt12345" but i didnt find any way to get a "trigger_configuration" in api docs. 

0
1 comment

Hello!

It appears that the trigger above is provided by [this third-party plugin](https://github.com/rhysgodfrey/team-city-delayed-finish-build-trigger), so I can only assume that

trigger_configuration

is indeed the property that holds the reference to the watched build configuration. If that is the case, you may retrieve a build configuration by a known internalID via below call:

GET <TeamCity URL>/app/rest/buildTypes/internalId:<build configuration internal ID>

In your case this call would transform to

GET https://teamcity.mycompany.com/app/rest/buildTypes/internalId:bt12345

Please let me know if this helps.

0

Please sign in to leave a comment.