Refs - Update Ref
鎖定或解除鎖定分支。
PATCH https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/refs?filter={filter}&api-version=5.0
PATCH https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/refs?filter={filter}&projectId={projectId}&api-version=5.0
URI 參數
| 名稱 | 位於 | 必要 | 類型 | Description |
|---|---|---|---|---|
|
organization
|
path | True |
string |
Azure DevOps 組織的名稱。 |
|
repository
|
path | True |
string |
存放庫的名稱或識別碼。 |
|
project
|
path |
string |
專案識別碼或專案名稱 |
|
|
api-version
|
query | True |
string |
要使用的 API 版本。 這應該設定為 '5.0' 以使用此版本的 API。 |
|
filter
|
query | True |
string |
要鎖定/解除鎖定的分支名稱 |
|
project
|
query |
string |
小組專案的識別碼或名稱。 如果指定存放庫的識別碼,則為選擇性。 |
要求本文
| 名稱 | 類型 | Description |
|---|---|---|
| isLocked |
boolean |
|
| name |
string |
|
| newObjectId |
string |
|
| oldObjectId |
string |
|
| repositoryId |
string |
回應
| 名稱 | 類型 | Description |
|---|---|---|
| 200 OK |
成功作業 |
安全性
oauth2
類型:
oauth2
Flow:
accessCode
授權 URL:
https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
權杖 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
範圍
| 名稱 | Description |
|---|---|
| vso.code_write | 授與讀取、更新和刪除原始程式碼、存取認可、變更集、分支和其他版本控制成品的相關中繼資料。 也授與建立和管理提取要求和程式碼檢閱的能力,以及透過服務勾點接收版本控制事件的通知。 |
範例
Lock/unlock branch
範例要求
PATCH https://dev.azure.com/fabrikam/_apis/git/repositories/{repositoryId}/refs?filter=heads/master&api-version=5.0
{
"isLocked": true
}
範例回覆
{
"name": "refs/heads/master",
"objectId": "ffe9cba521f00d7f60e322845072238635edb451",
"isLockedBy": {
"displayName": "Normal Paulk",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/ac5aaba6-a66a-4e1d-b508-b060ec624fa9",
"_links": {
"avatar": {
"href": "https://dev.azure.com/fabrikam/_apis/GraphProfile/MemberAvatars/aad.YmFjMGYyZDctNDA3ZC03OGRhLTlhMjUtNmJhZjUwMWFjY2U5"
}
},
"id": "ac5aaba6-a66a-4e1d-b508-b060ec624fa9",
"uniqueName": "dev@mailserver.com",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=ac5aaba6-a66a-4e1d-b508-b060ec624fa9",
"descriptor": "aad.YmFjMGYyZDctNDA3ZC03OGRhLTlhMjUtNmJhZjUwMWFjY2U5"
},
"isLocked": true,
"creator": {
"displayName": "Normal Paulk",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/ac5aaba6-a66a-4e1d-b508-b060ec624fa9",
"_links": {
"avatar": {
"href": "https://dev.azure.com/fabrikam/_apis/GraphProfile/MemberAvatars/aad.YmFjMGYyZDctNDA3ZC03OGRhLTlhMjUtNmJhZjUwMWFjY2U5"
}
},
"id": "ac5aaba6-a66a-4e1d-b508-b060ec624fa9",
"uniqueName": "dev@mailserver.com",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=ac5aaba6-a66a-4e1d-b508-b060ec624fa9",
"descriptor": "aad.YmFjMGYyZDctNDA3ZC03OGRhLTlhMjUtNmJhZjUwMWFjY2U5"
},
"url": "https://dev.azure.com/fabrikam/7484f783-66a3-4f27-b7cd-6b08b0b077ed/_apis/git/repositories/d3d1760b-311c-4175-a726-20dfc6a7f885/refs?filter=heads%2Fmaster"
}
定義
| 名稱 | Description |
|---|---|
|
Git |
|
|
Git |
|
|
Git |
這個類別包含張貼狀態之服務/延伸模組的中繼資料。 |
|
Git |
可唯一識別狀態的狀態內容。 |
|
Git |
狀態的狀態。 |
|
Identity |
|
|
Reference |
表示 REST 參考連結集合的類別。 |
GitRef
| 名稱 | 類型 | Description |
|---|---|---|
| _links |
表示 REST 參考連結集合的類別。 |
|
| creator | ||
| isLocked |
boolean |
|
| isLockedBy | ||
| name |
string |
|
| objectId |
string |
|
| peeledObjectId |
string |
|
| statuses |
這個類別包含張貼狀態之服務/延伸模組的中繼資料。 |
|
| url |
string |
GitRefUpdate
| 名稱 | 類型 | Description |
|---|---|---|
| isLocked |
boolean |
|
| name |
string |
|
| newObjectId |
string |
|
| oldObjectId |
string |
|
| repositoryId |
string |
GitStatus
這個類別包含張貼狀態之服務/延伸模組的中繼資料。
| 名稱 | 類型 | Description |
|---|---|---|
| _links |
參考連結。 |
|
| context |
狀態的內容。 |
|
| createdBy |
建立狀態的身分識別。 |
|
| creationDate |
string |
建立狀態的日期和時間。 |
| description |
string |
狀態原因。 通常描述狀態的目前狀態。 |
| id |
integer |
狀態識別碼。 |
| state |
狀態的狀態。 |
|
| targetUrl |
string |
具有狀態詳細資料的 URL。 |
| updatedDate |
string |
狀態的上次更新日期和時間。 |
GitStatusContext
可唯一識別狀態的狀態內容。
| 名稱 | 類型 | Description |
|---|---|---|
| genre |
string |
狀態的內容類型。 通常產生狀態的服務/工具名稱可以是空的。 |
| name |
string |
狀態的名稱識別碼不能是 Null 或空白。 |
GitStatusState
狀態的狀態。
| 值 | Description |
|---|---|
| error |
發生錯誤的狀態。 |
| failed |
狀態失敗。 |
| notApplicable |
狀態不適用於目標物件。 |
| notSet |
未設定狀態。 預設狀態。 |
| pending |
狀態暫止。 |
| succeeded |
狀態成功。 |
IdentityRef
| 名稱 | 類型 | Description |
|---|---|---|
| _links |
此欄位包含圖表主旨的相關零或更多有趣連結。 您可以叫用這些連結來取得其他關聯性,或取得此圖表主體的詳細資訊。 |
|
| descriptor |
string |
描述項是在系統執行時參考圖形主旨的主要方式。 此欄位可唯一識別帳戶和組織之間的相同圖表主旨。 |
| directoryAlias |
string |
|
| displayName |
string |
這是圖形主體的非唯一顯示名稱。 若要變更此欄位,您必須變更來源提供者中的值。 |
| id |
string |
|
| imageUrl |
string |
|
| inactive |
boolean |
|
| isAadIdentity |
boolean |
|
| isContainer |
boolean |
|
| isDeletedInOrigin |
boolean |
|
| profileUrl |
string |
|
| uniqueName |
string |
|
| url |
string |
此 URL 是此圖形主體來源資源的完整路由。 |
ReferenceLinks
表示 REST 參考連結集合的類別。
| 名稱 | 類型 | Description |
|---|---|---|
| links |
object |
連結的唯讀檢視。 因為參考連結是唯讀的,所以我們只想要將它們公開為唯讀。 |