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
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
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
What I've seen:
- The url response of Build 1 has shown the expected work item list
- The url response of Build 2 has shown count is 0
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.