Pull Request Query - Get

This API is used to find what pull requests are related to a given commit. It can be used to either find the pull request that created a particular merge commit or it can be used to find all pull requests that have ever merged a particular commit. The input is a list of queries which each contain a list of commits. For each commit that you search against, you will get back a dictionary of commit -> pull requests.

POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullrequestquery?api-version=5.0

URI Parameters

Name In Required Type Description
organization
path True

string

The name of the Azure DevOps organization.

repositoryId
path True

string

ID of the repository.

project
path

string

Project ID or project name

api-version
query True

string

Version of the API to use. This should be set to '5.0' to use this version of the api.

Request Body

Name Type Description
queries

GitPullRequestQueryInput[]

The queries to perform.

results

object[]

The results of the queries. This matches the QueryInputs list so Results[n] are the results of QueryInputs[n]. Each entry in the list is a dictionary of commit->pull requests.

Responses

Name Type Description
200 OK

GitPullRequestQuery

successful operation

Security

oauth2

Type: oauth2
Flow: accessCode
Authorization URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token URL: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

Scopes

Name Description
vso.code Grants the ability to read source code and metadata about commits, changesets, branches, and other version control artifacts. Also grants the ability to search code and get notified about version control events via service hooks.

Definitions

Name Description
GitPullRequestQuery

A set of pull request queries and their results.

GitPullRequestQueryInput

Pull request query input parameters.

GitPullRequestQueryType

The type of query to perform.

GitPullRequestQuery

A set of pull request queries and their results.

Name Type Description
queries

GitPullRequestQueryInput[]

The queries to perform.

results

object[]

The results of the queries. This matches the QueryInputs list so Results[n] are the results of QueryInputs[n]. Each entry in the list is a dictionary of commit->pull requests.

GitPullRequestQueryInput

Pull request query input parameters.

Name Type Description
items

string[]

The list of commit IDs to search for.

type

GitPullRequestQueryType

The type of query to perform.

GitPullRequestQueryType

The type of query to perform.

Name Type Description
commit

string

Search for pull requests that merged the supplied commits.

lastMergeCommit

string

Search for pull requests that created the supplied merge commits.

notSet

string

No query type set.