删除看板关联的Issue或者Pull Request¶
DELETE /api/v5/org/{owner}/kanban/{kanban_id}/remove_item
该接口用于删除指定看板中关联的 Issue 或 Pull Request。请求时需提供组织路径、看板 ID,并以数组形式指定各仓库下待移除的 Issue 与 Pull Request 的 iid 列表。
访问令牌支持说明¶
- AtomGit 用户访问令牌(AtomGit user access tokens)
是否允许匿名访问¶
此接口允许匿名访问
请求参数¶
| 参数名 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
owner |
path | string | 是 | 组织的路径 |
kanban_id |
path | string | 是 | 看板id |
Request Body:
请求体为对象数组,每个对象描述一条待移除的 Issue / Pull Request 关联项。
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "array",
"items": {
"type": "object",
"properties": {
"repo": {
"description": "仓库的路径",
"type": "string"
},
"issue_iids": {
"description": "仓库内issue的iid",
"type": "array",
"items": { "type": "integer" }
},
"pr_iids": {
"description": "仓库内pull request的iid",
"type": "array",
"items": { "type": "integer" }
}
},
"required": ["repo", "issue_iids", "pr_iids"]
}
}
响应参数¶
成功时响应体为空对象 {},无业务字段。
失败响应¶
该接口暂无已公开的业务失败响应,以下为框架层可能返回的通用错误示例,错误字段名以后端实际返回为准。
400 参数错误
401 未认证
HTTP 响应状态码¶
| 状态码 | 说明 |
|---|---|
200 |
成功(OK) |
400 |
参数错误(Bad request) |
401 |
需要认证(Requires authentication) |
403 |
禁止访问(Forbidden) |
404 |
请求路径不存在(Not found) |
500 |
系统内部错误(Internal server error) |
请求示例¶
参数说明¶
<owner>替换为组织路径(企业、组织或个人的地址 path);<kanban_id>替换为看板 id;<repo>替换为仓库路径;issue_iids/pr_iids分别替换为仓库内 issue 与 pull request 的 iid 列表。本接口允许匿名访问,示例可不携带访问令牌;如需携带,可在 URL 中追加access_token=<token>。
cURL¶
curl -X DELETE 'https://api.atomgit.com/api/v5/org/<owner>/kanban/<kanban_id>/remove_item' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '[{"repo": "<repo>", "issue_iids": [1, 2], "pr_iids": [3]}]'
JavaScript¶
// 原生 fetch (Node.js 18+ / 浏览器)
const response = await fetch("https://api.atomgit.com/api/v5/org/<owner>/kanban/<kanban_id>/remove_item", {
method: "DELETE",
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify([
{ repo: "<repo>", issue_iids: [1, 2], pr_iids: [3] },
]),
});
if (!response.ok) {
throw new Error(`请求失败: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
resp = requests.delete(
"https://api.atomgit.com/api/v5/org/<owner>/kanban/<kanban_id>/remove_item",
json=[
{"repo": "<repo>", "issue_iids": [1, 2], "pr_iids": [3]},
],
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
响应示例¶
状态码: 200
错误码¶
| 错误码 | 说明 |
|---|---|
400 |
参数错误或请求无法解析 |
401 |
未认证或凭证无效 |
403 |
禁止访问 |
404 |
请求路径不存在 |
500 |
系统内部错误 |
本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 gitcode-dev/atomgit-api-doc