跳转至

更新Issue或者Pull Request关联的看板

PUT /api/v5/org/{owner}/kanban/repo/{repo}/{type}/{iid}

该接口用于更新指定 Issue 或 Pull Request 所关联的看板。调用时需在请求体中提供目标看板的 ID,系统将重新绑定该 Issue 或 Pull Request 与对应看板的关联关系,操作成功后返回空对象。

访问令牌支持说明

  • AtomGit 用户访问令牌(AtomGit user access tokens)

是否允许匿名访问

此接口允许匿名访问

请求参数

参数名 位置 类型 必填 说明
owner path string 是 组织的路径
repo path string 是 仓库的路径
type path string 是 类型,枚举:issue / merge_request
iid path string 是 Issue 或者 Pull Request 的 IID

Request Body:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "kanban_id": {
      "description": "看板id",
      "type": "string"
    }
  },
  "required": ["kanban_id"]
}

响应参数

成功时响应体为空的 JSON 对象 {},不包含任何业务字段。

失败响应

该接口无业务失败响应。

HTTP 响应状态码

状态码 说明
200 成功(OK)
400 参数错误(Bad Request)
401 需要认证(Requires authentication)
403 禁止访问(Forbidden)
404 请求路径不存在(Not Found)
500 系统内部错误(Internal Server Error)

请求示例

参数说明

<owner> 替换为组织的路径(企业、组织或个人的地址 path);<repo> 替换为仓库的路径;<type> 替换为 issue 或 merge_request;<iid> 替换为 Issue 或 Pull Request 的 IID;<kanban_id> 替换为看板 ID。本接口允许匿名访问,也可携带 AtomGit 用户访问令牌。

cURL

curl -X PUT 'https://api.atomgit.com/api/v5/org/<owner>/kanban/repo/<repo>/<type>/<iid>' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"kanban_id": "<kanban_id>"}'

JavaScript

// 原生 fetch (Node.js 18+ / 浏览器)
const response = await fetch("https://api.atomgit.com/api/v5/org/<owner>/kanban/repo/<repo>/<type>/<iid>", {
  method: "PUT",
  headers: {
    "Content-Type": "application/json",
    "Accept": "application/json",
  },
  body: JSON.stringify({
    kanban_id: "<kanban_id>",
  }),
});

if (!response.ok) {
  throw new Error(`请求失败: ${response.status}`);
}

console.log(await response.json());

Python

import requests

resp = requests.put(
    "https://api.atomgit.com/api/v5/org/<owner>/kanban/repo/<repo>/<type>/<iid>",
    json={"kanban_id": "<kanban_id>"},
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

响应示例

状态码: 200

{}

错误码

错误码 说明
401 未认证或凭证无效(缺少/无效的访问凭证)
400 参数错误或请求无法解析
404 请求路径不存在
405 请求方法不支持
429 请求过于频繁,触发限流
500 系统内部错误

本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 gitcode-dev/atomgit-api-doc