Rune FS
Rune FS

Reputation: 21752

Getting state change for work items by sprint not date from Azure DevOps

I'm trying to collect the state of work items as it were in a particular iteration. I'm capable of getting the present state of the work items with a query to the REST API like this one:

https://analytics.dev.azure.com/{organisation}/{project}/_odata/v2.0/WorkItems?$expand=Iteration.

It does give me the creation, activation and completion date but I need to know which iteration it was created, activated and completed in

Upvotes: 1

Views: 1019

Answers (2)

Rune FS
Rune FS

Reputation: 21752

The solution turned out to be very simple. It had simply eluded me when searching

https://analytics.dev.azure.com/{organisation}/{project}/_odata/v2.0/WorkItemRevisions?$expand=Iteration

returns all revisions of the work items, including what iteration they were assigned to when the change happened

Upvotes: 2

Hugh Lin
Hugh Lin

Reputation: 19471

I need to know which iteration it was created, activated and completed in

For this demand,you can try to use this rest api:

GET https://{instance}/{collection}/{project}/_apis/wit/workItems/{id}/revisions?api-version=5.0

With this rest api, you can list all the revisions of the work item,and in each revision,you can see the iteration path of the work item and the state of the work item at that time.

The downside is that it can only be used for one work item. If you want to collect all the work items, it will be a bit cumbersome.

Upvotes: 1

Related Questions