Delen via


Pull Request Statuses - Get

Get the specific pull request status by ID. The status ID is unique within the pull request across all iterations.

GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullRequests/{pullRequestId}/statuses/{statusId}?api-version=4.1-preview.1

URI Parameters

Name In Required Type Description
organization
path True

string

The name of the Azure DevOps organization.

pullRequestId
path True

integer

int32

ID of the pull request.

repositoryId
path True

string

The repository ID of the pull request’s target branch.

statusId
path True

integer

int32

ID of the pull request status.

project
path

string

Project ID or project name

api-version
query True

string

Version of the API to use. This should be set to '4.1-preview.1' to use this version of the api.

Responses

Name Type Description
200 OK

GitPullRequestStatus

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 get notified about version control events via service hooks.
vso.code_status Grants the ability to read and write commit and pull request status.

Examples

Sample request

GET https://dev.azure.com/fabrikam/_apis/git/repositories/{repositoryId}/pullRequests/{pullRequestId}/statuses/{statusId}?api-version=4.1-preview.1

Sample response

{
  "id": 1,
  "state": "succeeded",
  "description": "Sample status succeeded",
  "context": {
    "name": "sample-status-1",
    "genre": "vsts-samples"
  },
  "creationDate": "2017-09-19T14:50:27.4949745Z",
  "updatedDate": "2017-09-19T14:50:27.4949745Z",
  "createdBy": {
    "id": "6f168adb-59d4-4fc0-be3b-fb21b939b2a6",
    "displayName": "Normal Paulk",
    "uniqueName": "fabrikamfiber16@hotmail.com",
    "url": "https://dev.azure.com/fabrikam/_apis/Identities/6f168adb-59d4-4fc0-be3b-fb21b939b2a6",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=6f168adb-59d4-4fc0-be3b-fb21b939b2a6"
  },
  "targetUrl": "http://fabrikam-fiber-inc.com/CI/builds/1",
  "_links": {
    "self": {
      "href": "https://dev.azure.com/fabrikam/_apis/git/repositories/b92c8408-a0c9-4292-88af-bc005a1b8272/pullRequests/5/statuses/1"
    },
    "repository": {
      "href": "https://dev.azure.com/fabrikam/_apis/git/repositories/b92c8408-a0c9-4292-88af-bc005a1b8272"
    }
  }
}

Definitions

Name Description
GitPullRequestStatus

This class contains the metadata of a service/extension posting pull request status. Status can be associated with a pull request or an iteration.

GitStatusContext

Status context that uniquely identifies the status.

GitStatusState

State of the status.

IdentityRef
PropertiesCollection

The class represents a property bag as a collection of key-value pairs. Values of all primitive types (any type with a TypeCode != TypeCode.Object) except for DBNull are accepted. Values of type Byte[], Int32, Double, DateType and String preserve their type, other primitives are retuned as a String. Byte[] expected as base64 encoded string.

ReferenceLinks

The class to represent a collection of REST reference links.

GitPullRequestStatus

This class contains the metadata of a service/extension posting pull request status. Status can be associated with a pull request or an iteration.

Name Type Description
_links

ReferenceLinks

Reference links.

context

GitStatusContext

Context of the status.

createdBy

IdentityRef

Identity that created the status.

creationDate

string

Creation date and time of the status.

description

string

Status description. Typically describes current state of the status.

id

integer

Status identifier.

iterationId

integer

ID of the iteration to associate status with. Minimum value is 1.

properties

PropertiesCollection

Custom properties of the status.

state

GitStatusState

State of the status.

targetUrl

string

URL with status details.

updatedDate

string

Last update date and time of the status.

GitStatusContext

Status context that uniquely identifies the status.

Name Type Description
genre

string

Genre of the status. Typically name of the service/tool generating the status, can be empty.

name

string

Name identifier of the status, cannot be null or empty.

GitStatusState

State of the status.

Name Type Description
error

string

Status with an error.

failed

string

Status failed.

notApplicable

string

Status is not applicable to the target object.

notSet

string

Status state not set. Default state.

pending

string

Status pending.

succeeded

string

Status succeeded.

IdentityRef

Name Type Description
_links

ReferenceLinks

This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject.

descriptor

string

The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations.

directoryAlias

string

displayName

string

This is the non-unique display name of the graph subject. To change this field, you must alter its value in the source provider.

id

string

imageUrl

string

inactive

boolean

isAadIdentity

boolean

isContainer

boolean

profileUrl

string

uniqueName

string

url

string

This url is the full route to the source resource of this graph subject.

PropertiesCollection

The class represents a property bag as a collection of key-value pairs. Values of all primitive types (any type with a TypeCode != TypeCode.Object) except for DBNull are accepted. Values of type Byte[], Int32, Double, DateType and String preserve their type, other primitives are retuned as a String. Byte[] expected as base64 encoded string.

Name Type Description
count

integer

The count of properties in the collection.

item

object

keys

string[]

The set of keys in the collection.

values

string[]

The set of values in the collection.

The class to represent a collection of REST reference links.

Name Type Description
links

object

The readonly view of the links. Because Reference links are readonly, we only want to expose them as read only.