文档

CreateConnection - 创建身份绑定

更新时间:
一键部署

创建一个身份绑定,将阿里云主账号与一个第三方代码托管平台(GitHub、Gitee、Codeup、...)的账号建立关联。

接口说明

使用注意事项:

  • GitHub、Gitee、Codeup:使用 OAuth 授权,需要您创建 Connection 实体后,点击 status 中的授权链接完成身份绑定
  • GitLab:使用私人令牌,在创建 Connection 实体的同时完成身份绑定

注意 一个“阿里云主账号”不能重复绑定同一个“代码托管平台账号” (即对于一个“代码托管平台账号”,至多存在一个已完成绑定的 Connection 实体)

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

当前API暂无授权信息透出。

请求语法

POST /2023-07-14/connections

请求参数

名称类型必填描述示例值
bodyConnection

计划创建的身份绑定实体

返回参数

名称类型描述示例值
Connection

成功创建的身份绑定实体

示例

正常返回示例

JSON格式

{
  "uid": "1455541096***548",
  "kind": "Connection",
  "createdTime": "2021-11-19T09:34:38Z",
  "name": "my-connection",
  "spec": {
    "platform": "github",
    "account": {
      "name": "your_username",
      "displayName": "your_displayname",
      "id": "1",
      "avatar": "https://gitee.com/assets/no_portrait.png",
      "uri": "https://gitlab.com"
    },
    "gitlabConfig": {
      "uri": "http://gitlab.c16194660f14898a0810408171302ac.cn-shanghai.alicontainer.com/",
      "token": "your-token"
    }
  },
  "labels": {
    "key": "key=value"
  },
  "resourceVersion": 1,
  "description": "test-description",
  "status": {
    "installation": {
      "stage": "finished",
      "message": "Please click 'actionUri' to complete the OAuth authorization process",
      "actionUri": "https://github.com/login/oauth/authorize?client_id=86059a1b2bb20d3e5fc3&scope=repo,repo:status,delete_repo"
    }
  },
  "generation": 1
}

错误码

访问错误中心查看更多错误码。

  • 本页导读