Using the Bitbucket REST API, I’m looking for a way to get all pull requests that are assigned to a user. So far this endpoint: https://api.bitbucket.org/2.0/repositories/{workspace}/{repository_name}/pullrequests/{pullrequest_id}?fields=reviewers will show me the reviewer assigned to that specific pull request ID. Is there a way to do that, but not for a specific pull request, rather all pull requests assigned to a user?
Related
Bitbucket has a remote merge facility. In the event that a target branch already contains the commits in a pull request, the PR will be remotely merged. I would like to determine which pull requests contain a commit so I can determine which approved pull requests led to the remote merge status.
From the API docs, I can use GET /rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/commits to identify the commits. Is there a reverse operation that shows pull requests for a specific commit?
I am not finding the info in the API page here: https://developer.atlassian.com/server/bitbucket/rest/v807/
I'm using the Microsoft.VisualStudio.Services.Client library (added via NuGet) to connect to my on-prem Azure Dev Ops server and query various bits of information regarding pull requests. I'd like to make a little notification application that can alert me if someone has replied to a comment I made on a pull request. The trick is that I only want to see the notification if I haven't already looked at it.
I know that the system knows when I last looked at the pull request because it decorates pull requests with new content (comments, new code, etc.) with a little dot and when I open a pull request, it tells me that there are new comments since I visited last and tells me how long ago I looked at it.
How do I get access to the date that I opened the pull request in the web via the client libraries or REST? In other words, how would my app know that I have or haven't looked at new comments via the web page?
I did not find such an api that can retrieve the timestamp the last time you looked at the PR.
There is lastUpdatedDate you can use to track the comments that were checked. So as a workaround you can save the lastUpdatedDate to a file in your code, and compare this value everytime when you call api. Then you will get the latest updated comments.
However, PR comments notification can also be configured from azure devops. You can go to your user profile on the top right corner and select notifications to enable the notification for A comment is left on a pull request.
For more information about Azure devops notification, you can check this document.
Under the Pull Requests to Review section of Bitbucket, it shows all of the pull requests that I am a reviewer of. How do I alter this so that when I approve a pull request, it no longer shows up under this section?
If this is Bitbucket Cloud (bitbucket.org), then there's an option on the dashboard for this:
Look to the right of the "Your work" label, and just above the list of pull requests, for the option.
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 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
I am working on automating the code review process in my team.
My objectives are:
When a review is created, assign it to two random developers
Automatically update the JIRA item, and assign them to the developers who were assigned as reviewers in Upsource
I was able to achieve objective #1 using Upsource Custom Workflows.
For the second objective, I have tried looking at Upsource Webhooks and JIRA Cloud REST API, but I fail to see how to assign a JIRA item from Upsource. JIRA's API specifies that in order to assign an item using REST, we need to create PUT request to this method:
PUT /rest/api/2/issue/{issueIdOrKey}/assignee
How can I create a PUT request from Upsource Webhooks?
How can I extract the {issueIDOrKey} from the originating Upsource review?
How can I create a PUT request from Upsource Webhooks?
Upsource webhooks send only POST requests at the moment. But I don't see how this limitation is blocking your task, because as I understand there has to be a service that'll translate Upsource payload to JIRA payload. That service should make a PUT request.
How can I extract the {issueIDOrKey} from the originating Upsource review?
Upsource provides an API for this. getReviewDetails method allows to get a list of issues associated with a given review (see this message spec).