Get all workitems from VSTS using REST API

2019-08-21 09:02发布

问题:

I'm working on fetching all the Workitems from VSTS using REST APIs. I come across this documentation Get data for each work item returned

It's a POST method and we are not passing any body, will it return all the workitems as mentioned in the documentation?

Thanks, Siva

回答1:

You could use Reporting Work Item Revisions API:

GET https://{accountName}.visualstudio.com/{project}/_apis/wit/reporting/workitemrevisions?api-version=5.0-preview.2

If you don't want to all revisions, you could add includeLatestOnly parameter:

GET https://{accountName}.visualstudio.com/{project}/_apis/wit/reporting/workitemrevisions?includeLatestOnly=true&api-version=5.0-preview.2


回答2:

According to the docs, the request body is optional, so your assumption is most likely correct. [Of course, it's better to try it once than guess ;-)]

However, the request like that can be inefficient if it runs on a large number of work items. Consider filtering it to narrow down the response data.