Git pull request reviewers

Last Update: 1/18/2017

api-version = 3.0-preview

This API in preview. Learn more

If you haven't already, look at the information on getting started with these APIs.

The primary action for reviewers is to vote to approve or reject the pull request. Some reviewers are automatically added based on the policies set on the target branch of the pull request.

Get a list of reviewers

GET https://{instance}/defaultcollection/_apis/git/repositories/{repository}/pullRequests/{pullRequest}/reviewers?api-version={version}
Parameter Type Notes
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
repository string ID of the repository.
pullRequest integer ID of the pull request.
Query
api-version string Version of the API to use.

Sample request

GET https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/git/repositories/3411ebc1-d5aa-464f-9615-0b527bc66719/pullRequests/22/reviewers?api-version=3.0

Sample response

Status code: 200
{
  "count": 1,
  "value": [
    {
      "reviewerUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/git/repositories/3411ebc1-d5aa-464f-9615-0b527bc66719/pullRequests/22/reviewers/d6245f20-2af8-44f4-9451-8107cb2767db",
      "vote": 0,
      "id": "d6245f20-2af8-44f4-9451-8107cb2767db",
      "displayName": "Normal Paulk",
      "uniqueName": "fabrikamfiber16@hotmail.com",
      "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/Identities/d6245f20-2af8-44f4-9451-8107cb2767db",
      "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=d6245f20-2af8-44f4-9451-8107cb2767db"
    }
  ]
}

Get a reviewer

GET https://{instance}/defaultcollection/_apis/git/repositories/{repository}/pullRequests/{pullRequest}/reviewers/{reviewer}?api-version={version}
Parameter Type Notes
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
repository string ID of the repository.
pullRequest integer ID of the pull request.
reviewer Guid ID of the reviewer. This can be retrieved from the Teams API or by getting a list of reviewers.
Query
api-version string Version of the API to use.

Sample request

GET https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/git/repositories/3411ebc1-d5aa-464f-9615-0b527bc66719/pullRequests/22/reviewers/19d9411e-9a34-45bb-b985-d24d9d87c0c9?api-version=3.0

Sample response

Status code: 200
{
  "reviewerUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/git/repositories/3411ebc1-d5aa-464f-9615-0b527bc66719/pullRequests/22/reviewers/19d9411e-9a34-45bb-b985-d24d9d87c0c9",
  "vote": 0,
  "id": "19d9411e-9a34-45bb-b985-d24d9d87c0c9",
  "displayName": "Johnnie McLeod",
  "uniqueName": "fabrikamfiber2@hotmail.com",
  "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/Identities/19d9411e-9a34-45bb-b985-d24d9d87c0c9",
  "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=19d9411e-9a34-45bb-b985-d24d9d87c0c9"
}

Add a reviewer

Adds a reviewer and optionally sets their vote.

PUT https://{instance}/defaultcollection/_apis/git/repositories/{repository}/pullRequests/{pullRequest}/reviewers/{reviewer}?api-version={version}
{
    "vote": {integer}
}
Parameter Type Default Notes
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
repository string ID of the repository.
pullRequest integer ID of the pull request.
reviewer Guid ID of the reviewer.
Query
api-version string Version of the API to use.
Body
vote enum {-10, -5, 0, 5, 10} -10 means "Rejected", -5 means "Waiting for author", 0 means "No response", 5 means "Approved with suggestions", and 10 means "Approved".

Sample request

PUT https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/git/repositories/3411ebc1-d5aa-464f-9615-0b527bc66719/pullRequests/22/reviewers/19d9411e-9a34-45bb-b985-d24d9d87c0c9?api-version=3.0
Content-Type: application/json
{
  "vote": 0
}

Sample response

Status code: 200
{
  "reviewerUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/git/repositories/3411ebc1-d5aa-464f-9615-0b527bc66719/pullRequests/22/reviewers/19d9411e-9a34-45bb-b985-d24d9d87c0c9",
  "vote": 0,
  "id": "19d9411e-9a34-45bb-b985-d24d9d87c0c9",
  "displayName": "Johnnie McLeod",
  "uniqueName": "fabrikamfiber2@hotmail.com",
  "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/Identities/19d9411e-9a34-45bb-b985-d24d9d87c0c9",
  "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=19d9411e-9a34-45bb-b985-d24d9d87c0c9"
}

Remove a reviewer

Removes a reviewer and their vote from a pull request.

DELETE https://{instance}/defaultcollection/_apis/git/repositories/{repository}/pullRequests/{pullRequest}/reviewers/{reviewer}?api-version={version}
Parameter Type Notes
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
repository string ID of the repository.
pullRequest integer ID of the pull request.
reviewer Guid ID of the reviewer.
Query
api-version string Version of the API to use.

Sample request

DELETE https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/git/repositories/3411ebc1-d5aa-464f-9615-0b527bc66719/pullRequests/22/reviewers/19d9411e-9a34-45bb-b985-d24d9d87c0c9?api-version=3.0

Sample response

Status code: 200

Update a reviewer's vote

PUT https://{instance}/defaultcollection/_apis/git/repositories/{repository}/pullRequests/{pullRequest}/reviewers/{reviewer}?api-version={version}
{
  "vote": {integer}
}
Parameter Type Notes
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
repository string ID of the repository.
pullRequest integer ID of the pull request.
reviewer Guid ID of the reviewer. Must be an actual user (not a team or group).
Query
api-version string Version of the API to use.
Body
vote enum {-10, -5, 0, 5, 10} -10 means "Rejected", -5 means "Waiting for author", 0 means "No response", 5 means "Approved with suggestions", and 10 means "Approved".

Sample request

PUT https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/git/repositories/3411ebc1-d5aa-464f-9615-0b527bc66719/pullRequests/22/reviewers/d6245f20-2af8-44f4-9451-8107cb2767db?api-version=3.0
Content-Type: application/json
{
  "vote": 10
}

Sample response

Status code: 200
{
  "reviewerUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/git/repositories/3411ebc1-d5aa-464f-9615-0b527bc66719/pullRequests/22/reviewers/d6245f20-2af8-44f4-9451-8107cb2767db",
  "vote": 10,
  "id": "d6245f20-2af8-44f4-9451-8107cb2767db",
  "displayName": "Normal Paulk",
  "uniqueName": "fabrikamfiber16@hotmail.com",
  "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/Identities/d6245f20-2af8-44f4-9451-8107cb2767db",
  "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=d6245f20-2af8-44f4-9451-8107cb2767db"
}