Github Connections - Update

在指定的 GitHub 連線內新增或移除倉庫清單。

POST https://dev.azure.com/{organization}/{project}/_apis/githubconnections/{connectionId}/reposBatch?api-version=7.2-preview.1

URI 參數

名稱 位於 必要 類型 Description
connectionId
path True

string (uuid)

organization
path True

string

Azure DevOps 組織的名稱。

project
path True

string

項目識別碼或項目名稱

api-version
query True

string

要使用的 API 版本。 這應該設定為 『7.2-preview.1』 以使用此版本的 API。

要求本文

名稱 類型 Description
gitHubRepositoryUrls

GitHubConnectionRepoModel[]

要求的存放庫 URL

gitHubUserToken

string

可選的 GitHub 存取權杖用於驗證新增與移除操作的配置。 新增也需要管理員權限才能存取這些倉庫。

operationType

string

作業類型 (f. e. add, remove)

回應

名稱 類型 Description
200 OK

GitHubConnectionRepoModel[]

成功作業

安全性

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.githubconnections_manage 賦予讀取和管理 GitHub 連線及 GitHub 倉庫資料的能力

範例

Add list of repos to the specified github connection
Remove list of repos from the specified github connection

Add list of repos to the specified github connection

範例要求

POST https://dev.azure.com/{organization}/{project}/_apis/githubconnections/{connectionId}/reposBatch?api-version=7.2-preview.1

{
  "gitHubRepositoryUrls": [
    {
      "gitHubRepositoryUrl": "https://github.com/test-account/repo1"
    },
    {
      "gitHubRepositoryUrl": "https://github.com/test-account/repo2"
    },
    {
      "gitHubRepositoryUrl": "https://github.com/test-account/repo3"
    },
    {
      "gitHubRepositoryUrl": "https://github.com/test-account/repo399"
    }
  ],
  "operationType": "add"
}

範例回覆

{
  "count": 4,
  "value": [
    {
      "gitHubRepositoryUrl": "https://github.com/test-account/repo3"
    },
    {
      "gitHubRepositoryUrl": "https://github.com/test-account/repo2"
    },
    {
      "gitHubRepositoryUrl": "https://github.com/test-account/repo1",
      "errorMessage": "Failed to find repository"
    },
    {
      "gitHubRepositoryUrl": "https://github.com/test-account/repo399",
      "errorMessage": "Failed to find repository"
    }
  ]
}

Remove list of repos from the specified github connection

範例要求

POST https://dev.azure.com/{organization}/{project}/_apis/githubconnections/{connectionId}/reposBatch?api-version=7.2-preview.1

{
  "gitHubRepositoryUrls": [
    {
      "gitHubRepositoryUrl": "https://github.com/test-account/repo1"
    },
    {
      "gitHubRepositoryUrl": "https://github.com/test-account/repo2"
    },
    {
      "gitHubRepositoryUrl": "https://github.com/test-account/repo3"
    },
    {
      "gitHubRepositoryUrl": "https://github.com/test-account/repo399"
    }
  ],
  "operationType": "remove"
}

範例回覆

{
  "count": 4,
  "value": [
    {
      "gitHubRepositoryUrl": "https://github.com/test-account/repo3"
    },
    {
      "gitHubRepositoryUrl": "https://github.com/test-account/repo2"
    },
    {
      "gitHubRepositoryUrl": "https://github.com/test-account/repo1",
      "errorMessage": "Repository is not connected to this team project"
    },
    {
      "gitHubRepositoryUrl": "https://github.com/test-account/repo399",
      "errorMessage": "Repository is not connected to this team project"
    }
  ]
}

定義

名稱 Description
GitHubConnectionRepoModel

描述 Github 連線的倉庫。

GitHubConnectionReposBatchRequest

描述 Github 連線的 repo 批量請求

GitHubConnectionRepoModel

描述 Github 連線的倉庫。

名稱 類型 Description
errorMessage

string

錯誤訊息

gitHubRepositoryUrl

string

存放庫 Web URL

GitHubConnectionReposBatchRequest

描述 Github 連線的 repo 批量請求

名稱 類型 Description
gitHubRepositoryUrls

GitHubConnectionRepoModel[]

要求的存放庫 URL

gitHubUserToken

string

可選的 GitHub 存取權杖用於驗證新增與移除操作的配置。 新增也需要管理員權限才能存取這些倉庫。

operationType

string

作業類型 (f. e. add, remove)