Lorenzo Isidori
Lorenzo Isidori

Reputation: 2047

Azure Devops api get retained builds

I want to use Azure Devops rest apis to get all retained builds of a specific build definition.

Reading Azure Devops documentation I tried this api:

https://dev.azure.com/{organization}/{project}/_apis/build/builds?definitions=1

With this I get all build of my build definition '1'.

Each build has the 'keepForever' property. If this has value 'true', that is a retained build.

Usually the retained builds are fewer than non retained. I'd want to have just the retained ones.

I tried to add the 'keepForever=true' query string parameter with no luck.

Is there a way to made the http request to get retained builds only?

Can I avoid to read much data I don't want?

Upvotes: 1

Views: 1403

Answers (1)

Shamrai Aleksander
Shamrai Aleksander

Reputation: 16018

You can find a list of parameters here: Builds - List - URI Parameters. There is no keepForever in that list and no any additional filter options for this parameter. As workaround, you may try to set some tag for retained builds and then use tagFilters parameter. But that maybe more complex way than filter keepForever property with your code.

Upvotes: 3

Related Questions