Is it possible to set snapshot dependencies using the API?

Is it possible to set a snapshot dependency using the API?

I'm working on a build workflow that automatically creates new deployment configurations based on deployment packages in a folder (when new ones are added by the build).  I need to be able to run each of these configurations independently if necessary, but I also need a "trigger all" option.  I can get the "trigger all" configuration to work like I want but I have to manually add the new (automatically created) configuration as a snapshot dependency.

Is it possible to update the snapshot dependencies in the "trigger all" configuration to also depend on the newly created configuration?  This does not have to be through the API if there are other programmatic ways to do this.

Thanks

0
4 comments

Hi Robert,

Yes, it's possible to set snapshot dependencies through the REST API. Path is here: /app/rest/buildTypes/<build_config_locator>/snapshot-dependencies

Posting to that URL a content equal to what you would get by GETting an item from it should work. If you have any issues with that, please feel free to ask.

1
Avatar
Permanently deleted user

Hi,

 

I have similar case. I could see the existing snapshot dependencies. 

GET http://teamcity:8111/app/rest/buildTypes/<buildLocator>/snapshot-dependencies

I could also delete the snapshot dependency

DELETE GET http://teamcity:8111/app/rest/buildTypes/<buildLocator>/snapshot-dependencies/<snapshotid>

But i could not add the snapshot dependency 

PUT http://teamcity:8111/app/rest/buildTypes/<buildLocator>/snapshot-dependencies

content-type : text\plain

<buildid>

 

Could you please help on this. I am getting the below error for the PUT operation

Error has occurred during request processing (Unsupported Media Type).
Make sure you have supplied correct Content-Type header.

 

 

 

 

 

 

0

Hi Pr,

as I pointed out in the answer just above your comment, you need to pass a structure (in xml or json) equivalent to that of what you get when you are requesting a dependency. Simply pointing to a build id (or more specifically to a build configuration ID) is not going to work, snapshot dependencies are a bit more complex than simply a number.

0
Avatar
Permanently deleted user

Thanks Denis.

 

It worked now.did  POST with  snapshot dependency in the form i received on GET

0

Please sign in to leave a comment.