0

We have recently ported over to DevOps. I need to use The DevOps API to Get a list of WorkItems which has a particular value in a Custom Field, "Product Version". (which is set on EVERY work item) so we can see which work items are to be included in the release of this product. This could Span multiple repositories in a single Project.

The only thing I can see is the Work Items list, but I'd need To provide a list of IDs for that, which is what I am trying to get!

GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems?ids={ids}&api-version=5.1

I'm surprised you cannot get a list of workitems base on some other criteria/Grouping. if the above is not possible, is there some other way to set up our WorkItems so we can get this information?

Many thanks

Andrew Humphries
  • 167
  • 3
  • 15

1 Answers1

0

You should use Wiql - Query By Wiql API instead. For example:

POST https://dev.azure.com/{organization}/{project}/{team}/_apis/wit/wiql?api-version=5.1

Request Body

{
   "query": "Select [System.Id], [System.Title], [System.State] From WorkItems Where [System.TeamProject] = 'TeamProject' and ([System.WorkItemType] = 'Task' or [System.WorkItemType] = 'Bug' or [System.WorkItemType] = 'Product Backlog Item') and [ProductVersion] = 'xxx'"
}
Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39