RestAPI - Custom Build ModificationID

Hi,

I am trying to trigger a nightly build by running a 'last known successful' custom build on a project.
I notice you can run a custom build by passing in a modifcationId

e.g

httpAuth/action.html?add2Queue=bt27&modificationId=3605


However I cannot see how to extract a modifcationId from the rest api.

I can get the last build number with the following call

httpAuth/app/rest/buildTypes/id:bt27/builds/status:SUCCESS/number

Can anyone point me in the right direction or suggest a better way of doing this. The build project in question does not produce any artifacts since it is a .net 4.0  web MSDeployPublish therefore I cannot use an artifact dependency. I would just like to rerun the project with different configuration options from a given point in time (modificationId).

Thanks in advance.
4 comments
Comment actions Permalink

Hi

Is TW-14975 related your request? If so, please vote for it.

Modification ID can be obtained at /httpAuth/api/changes?build=id:868615
Note that the list may be empty if the build was triggered without changes.

Michael

0
Comment actions Permalink

Thanks for the reply Michael,

I found the modifcationId in the changes response - however it is called id, not great.

/httpAuth/app/rest/buildTypes/id:bt27/builds/status:SUCCESS (to get the last good build id)

/httpAuth/app/rest/changes?buildType=id:bt27&count=10 (get last x changes and then match the "version" to the buildId and grab the @id which is actually the modificationId!)

httpAuth/action.html?add2Queue=bt27&modificationId={0}


A rather convoluted way to go about things and I wish the responses would be consistent with the named fields....why is modiciationId id in certain responses

0
Comment actions Permalink

Hello,

The id in question is the internal id of the change detected by TeamCity.

When you get the list of changes via REST API it is called "id" (as it is "id" of the change entity returned).

When you trigger a build, you pass it as "modificationId" as in the context of the build configuraiton there are many entities and "modificationId" points to specific one.

So the only issue is that the same entity is referenced as "modification" and "change" in different requests.

Actually, the request to run a build is not part of REST API so the naming is not consitent as it was never meant to be. When we add ability to start a build into REST, we will try to unify things a bit.


A solution that would suite your needs can be to add modification ID to the build entity itself, but so far this seems as exposing too much internal stuff in the entity.

0
Comment actions Permalink

Hi Yegor,

Sorry if my reply sounded a little harsh - it was not my intention since I love the product and I have got what I wanted to work.

I have voted for a few of the api change requests which will hopefully make it into TeamCity over the next few releases.

Keep up the great work.

Cheers

0

Please sign in to leave a comment.