I would like to access information about all pull requests that are linked to a particular work item.
The relations on a work item result (e.g. https://.../_apis/wit/workItems/12345?$expand=all) shows links to the pull requests in this form:
vstfs:///Git/PullRequestId/...
How can I turn that relationship URI into the canonical URL for the pull request using the VSTS REST API? (e.g. https://.../_apis/git/repositories/.../pullRequests/1234
)
To track the progress of a single pull request, choose the actions icon for the pull request, and select the Follow option. This signals the system to notify you when changes are made to the PR.
A pull request (PR) is more than just a notification—it's a dedicated forum for discussing the proposed feature. If there are any problems with the changes, teammates can post feedback in the pull request and even tweak the feature by pushing follow-up commits, which allows you to save your changes to the repository.
To parse information of the GET Pull Request REST API from the response of GET work item REST API, you just need to get the pull request id.
From the response of the GET work item REST API, you can get the pull request URL as:
vstfs:///Git/PullRequestId/f7855e29-6f8d-429d-8c9b-41fd4d7e70a4%2Fe89075b8-d7bd-4c3f-b24c-23276d89e8ec%2F106
Then get the pull request, you can split the string with %2F
, then the pull request id is the last part (as the pull request id is 106
in above example).
And to get the pull request detail by the rest api as below:
GET https://{account}.visualstudio.com/_apis/git/pullrequests/{pullrequestID}?api-version=4.1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With