次の方法で共有


Pull Request Statuses - Create

プル要求の状態を作成します。

状態に必要なフィールドは、状態を一意に識別する Context.Name のみです。 要求本文で iterationId を指定して、イテレーションの状態をポストできることに注意してください。

POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullRequests/{pullRequestId}/statuses?api-version=7.1

URI パラメーター

名前 / 必須 説明
organization
path True

string

Azure DevOps 組織の名前。

pullRequestId
path True

integer (int32)

プル要求の ID。

repositoryId
path True

string

プル要求のターゲット ブランチのリポジトリ ID。

project
path

string

プロジェクト ID またはプロジェクト名

api-version
query True

string

使用する API のバージョン。 このバージョンの API を使用するには、これを '7.1' に設定する必要があります。

要求本文

名前 説明
_links

ReferenceLinks

参照リンク。

context

GitStatusContext

状態のコンテキスト。

createdBy

IdentityRef

状態を作成した ID。

creationDate

string (date-time)

状態の作成日時。

description

string

状態の説明。 通常、状態の現在の状態について説明します。

id

integer (int32)

状態識別子。

iterationId

integer (int32)

状態を関連付けるイテレーションの ID。 最小値は 1 です。

properties

PropertiesCollection

状態のカスタム プロパティ。

state

GitStatusState

状態の状態。

targetUrl

string

状態の詳細を含む URL。

updatedDate

string (date-time)

状態の最終更新日時。

応答

名前 説明
200 OK

GitPullRequestStatus

成功した操作

セキュリティ

oauth2

型: oauth2
フロー: accessCode
Authorization URL (承認 URL): https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token URL (トークン 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

スコープ

名前 説明
vso.code_write ソース コードの読み取り、更新、削除、コミット、変更セット、ブランチ、およびその他のバージョン管理成果物に関するメタデータへのアクセスを許可します。 また、プル要求とコード レビューを作成および管理したり、サービス フックを介してバージョン管理イベントに関する通知を受信したりすることもできます。
vso.code_status コミットとプル要求の状態の読み取りと書き込みを行う機能を付与します。

On iteration
On pull request
With properties

On iteration

要求のサンプル

POST https://dev.azure.com/fabrikam/_apis/git/repositories/{repositoryId}/pullRequests/{pullRequestId}/statuses?api-version=7.1

{
  "iterationId": 1,
  "state": "succeeded",
  "description": "Sample status succeeded",
  "context": {
    "name": "sample-status-2",
    "genre": "vsts-samples"
  },
  "targetUrl": "http://fabrikam-fiber-inc.com/CI/builds/1"
}

応答のサンプル

{
  "iterationId": 1,
  "id": 1,
  "state": "succeeded",
  "description": "Sample status succeeded",
  "context": {
    "name": "sample-status-2",
    "genre": "vsts-samples"
  },
  "creationDate": "2017-09-19T14:50:26.4429056Z",
  "updatedDate": "2017-09-19T14:50:26.4429056Z",
  "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/2/statuses/1"
    },
    "repository": {
      "href": "https://dev.azure.com/fabrikam/_apis/git/repositories/b92c8408-a0c9-4292-88af-bc005a1b8272"
    }
  }
}

On pull request

要求のサンプル

POST https://dev.azure.com/fabrikam/_apis/git/repositories/{repositoryId}/pullRequests/{pullRequestId}/statuses?api-version=7.1

{
  "state": "succeeded",
  "description": "Sample status succeeded",
  "context": {
    "name": "sample-status-4",
    "genre": "vsts-samples"
  },
  "targetUrl": "http://fabrikam-fiber-inc.com/CI/builds/1"
}

応答のサンプル

{
  "id": 1,
  "state": "succeeded",
  "description": "Sample status succeeded",
  "context": {
    "name": "sample-status-4",
    "genre": "vsts-samples"
  },
  "creationDate": "2017-09-19T14:50:25.1680228Z",
  "updatedDate": "2017-09-19T14:50:25.1680228Z",
  "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/1/statuses/1"
    },
    "repository": {
      "href": "https://dev.azure.com/fabrikam/_apis/git/repositories/b92c8408-a0c9-4292-88af-bc005a1b8272"
    }
  }
}

With properties

要求のサンプル

POST https://dev.azure.com/fabrikam/_apis/git/repositories/{repositoryId}/pullRequests/{pullRequestId}/statuses?api-version=7.1

{
  "properties": {
    "sampleId": 7,
    "customInfo": "Custom status information",
    "startedDateTime": {
      "$type": "System.DateTime",
      "$value": "2017-09-19T14:50:26.7410146Z"
    },
    "weight": {
      "$type": "System.Double",
      "$value": 1.75
    },
    "bytes": {
      "$type": "System.Byte[]",
      "$value": "dGhpcyBpcyBzYW1wbGUgYmFzZTY0IGVuY29kZWQgc3RyaW5n"
    },
    "globalId": {
      "$type": "System.Guid",
      "$value": "1e788cb9-9d3d-4dc6-ac05-822092d17f90"
    }
  },
  "state": "succeeded",
  "description": "Sample status succeeded",
  "context": {
    "name": "sample-status-1",
    "genre": "vsts-samples"
  },
  "targetUrl": "http://fabrikam-fiber-inc.com/CI/builds/1"
}

応答のサンプル

{
  "properties": {
    "bytes": {
      "$type": "System.Byte[]",
      "$value": "dGhpcyBpcyBzYW1wbGUgYmFzZTY0IGVuY29kZWQgc3RyaW5n"
    },
    "customInfo": {
      "$type": "System.String",
      "$value": "Custom status information"
    },
    "globalId": {
      "$type": "System.String",
      "$value": "1e788cb99d3d4dc6ac05822092d17f90"
    },
    "sampleId": {
      "$type": "System.Int32",
      "$value": 7
    },
    "startedDateTime": {
      "$type": "System.DateTime",
      "$value": "2017-09-19T14:50:26.74Z"
    },
    "weight": {
      "$type": "System.Double",
      "$value": 1.75
    }
  },
  "id": 1,
  "state": "succeeded",
  "description": "Sample status succeeded",
  "context": {
    "name": "sample-status-1",
    "genre": "vsts-samples"
  },
  "creationDate": "2017-09-19T14:50:26.7780242Z",
  "updatedDate": "2017-09-19T14:50:26.7780242Z",
  "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/3/statuses/1"
    },
    "repository": {
      "href": "https://dev.azure.com/fabrikam/_apis/git/repositories/b92c8408-a0c9-4292-88af-bc005a1b8272"
    }
  }
}

定義

名前 説明
GitPullRequestStatus

このクラスには、プル要求の状態を投稿するサービス/拡張機能のメタデータが含まれています。 状態は、プル要求またはイテレーションに関連付けることができます。

GitStatusContext

状態を一意に識別する状態コンテキスト。

GitStatusState

状態の状態。

IdentityRef
PropertiesCollection

このクラスは、キーと値のペアのコレクションとしてプロパティ バッグを表します。 DBNull を除くすべてのプリミティブ型 (TypeCode != TypeCode.Objectを持つ任意の型) の値が受け入れられます。 Byte[]、Int32、Double、DateType、String 型の値は型を保持し、他のプリミティブは文字列として再調整されます。 Byte[] は base64 でエンコードされた文字列として必要です。

ReferenceLinks

REST 参照リンクのコレクションを表すクラス。

GitPullRequestStatus

このクラスには、プル要求の状態を投稿するサービス/拡張機能のメタデータが含まれています。 状態は、プル要求またはイテレーションに関連付けることができます。

名前 説明
_links

ReferenceLinks

参照リンク。

context

GitStatusContext

状態のコンテキスト。

createdBy

IdentityRef

状態を作成した ID。

creationDate

string (date-time)

状態の作成日時。

description

string

状態の説明。 通常、状態の現在の状態について説明します。

id

integer (int32)

状態識別子。

iterationId

integer (int32)

状態を関連付けるイテレーションの ID。 最小値は 1 です。

properties

PropertiesCollection

状態のカスタム プロパティ。

state

GitStatusState

状態の状態。

targetUrl

string

状態の詳細を含む URL。

updatedDate

string (date-time)

状態の最終更新日時。

GitStatusContext

状態を一意に識別する状態コンテキスト。

名前 説明
genre

string

ステータスのジャンル。 通常、状態を生成するサービス/ツールの名前は空にすることができます。

name

string

状態の名前識別子を null または空にすることはできません。

GitStatusState

状態の状態。

説明
error

エラーが発生した状態。

failed

状態が失敗しました。

notApplicable

状態はターゲット オブジェクトには適用されません。

notSet

状態が設定されていません。 既定の状態。

pending

保留中の状態。

succeeded

状態が成功しました。

IdentityRef

名前 説明
_links

ReferenceLinks

このフィールドには、グラフの件名に関する興味深いリンクが 0 個以上含まれています。 これらのリンクを呼び出して、このグラフの件名に関する追加のリレーションシップや詳細情報を取得できます。

descriptor

string

記述子は、システムの実行中にグラフの件名を参照する主な方法です。 このフィールドは、アカウントと組織の両方で同じグラフの件名を一意に識別します。

directoryAlias

string

非推奨 - IdentityRef "_links" ディクショナリの "自己" エントリで参照されている Graph ユーザーにクエリを実行することで取得できます

displayName

string

これは、グラフの件名の一意でない表示名です。 このフィールドを変更するには、ソース プロバイダーでその値を変更する必要があります。

id

string

imageUrl

string

非推奨 - IdentityRef "_links" ディクショナリの "アバター" エントリで使用できます

inactive

boolean

非推奨 - GraphUser "_links" ディクショナリの "membershipState" エントリで参照されている Graph メンバーシップの状態を照会することで取得できます

isAadIdentity

boolean

非推奨 - 記述子のサブジェクト型 (Descriptor.IsAadUserType/Descriptor.IsAadGroupType) から推論できます

isContainer

boolean

非推奨 - 記述子のサブジェクト型 (Descriptor.IsGroupType) から推論できます

isDeletedInOrigin

boolean

profileUrl

string

非推奨 - ToIdentityRef の既存のほとんどの実装では使用されていません

uniqueName

string

非推奨 - 代わりに Domain+PrincipalName を使用する

url

string

この URL は、このグラフの件名のソース リソースへの完全なルートです。

PropertiesCollection

このクラスは、キーと値のペアのコレクションとしてプロパティ バッグを表します。 DBNull を除くすべてのプリミティブ型 (TypeCode != TypeCode.Objectを持つ任意の型) の値が受け入れられます。 Byte[]、Int32、Double、DateType、String 型の値は型を保持し、他のプリミティブは文字列として再調整されます。 Byte[] は base64 でエンコードされた文字列として必要です。

名前 説明
count

integer (int32)

コレクション内のプロパティの数。

item

object

keys

string[]

コレクション内のキーのセット。

values

string[]

コレクション内の値のセット。

REST 参照リンクのコレクションを表すクラス。

名前 説明
links

object

リンクの読み取りビュー。 参照リンクは読み取り専用であるため、読み取り専用として公開する必要があります。