Home > OS >  Failed to get linked work items of build via azure devops REST API
Failed to get linked work items of build via azure devops REST API

Time:11-09

Use REST API

http://{collection}/{project}/_apis/build/builds/{buildid}/workitems?api-version=5.1

to get the linked work items of the following 2 build

  1. create branch which linked work items -> pull request -> merge -> build -> saw linked changes and work items in build summary -> use the REST API to get work items list

  2. create branch -> pull request which linked work items -> merge -> build -> saw linked changes and work items in build summary -> use the REST API to get work items list enter image description here

What I've seen:

  1. The url response of Build 1 has shown the expected work item list
  2. The url response of Build 2 has shown count is 0 enter image description here

What I want to know:

  • Why did The the REST API response differently for the above 2 builds?
  • Do I do something wrong with the api?

ENV: azure devops Dev17.M153.5

CodePudding user response:

In your second scenario, when you link a work item to the pull request, it is not accessible via /builds/build/<buildId>/workitems route. The pull requests are different entities in the system and the work items linked to the pull request directly are not considered those linked to the build.

The work items linked directly to the pull request can be accessed by a different endpoint.

  • Related