跳转至

取消用户审查 Pull Request

DELETE /api/v5/repos/{owner}/{repo}/pulls/{number}/assignees

该接口用于取消指定 Pull Request 上已指派的用户审查,撤回用户的审查资格,解除其审查任务,使该用户不再参与对该 Pull Request 的审查。

访问令牌支持说明

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

是否允许匿名访问

此接口不允许匿名访问

请求参数

参数名 位置 类型 必填 说明
owner path string 是 仓库所属空间地址(组织或个人的地址path)
repo path string 是 仓库路径(path)
number path integer 是 第几个PR,即本仓库PR的序数
access_token query string 是 用户授权码
assignees query string 否 用户的个人空间地址, 以 , 分隔

请求示例

参数说明

<owner> — 替换为仓库所属空间地址(组织或个人的地址 path); <repo> — 替换为仓库路径(path); <number> — 替换为第几个 PR(即本仓库 PR 的序数,从 0 开始); <assignees> — 替换为要取消审查的用户个人空间地址,多个以 , 分隔; <token> — 替换为你的 AtomGit 用户访问令牌。

cURL

curl -X DELETE 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/assignees?access_token=<token>&assignees=<assignees>' -H 'Accept: application/json'

JavaScript

// 原生 fetch (Node.js 18+ / 浏览器)
const url = new URL("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/assignees");
url.searchParams.set("access_token", "<YOUR-TOKEN>");
url.searchParams.set("assignees", "<assignees>");

const response = await fetch(url, {
  method: "DELETE",
  headers: {
    "Accept": "application/json",
  },
});

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

const data = await response.json();
console.log(data);

Python

import requests

url = "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/assignees"
params = {
    "access_token": "<YOUR-TOKEN>",
    "assignees": "<assignees>",
}

resp = requests.delete(url, params=params, timeout=10)
resp.raise_for_status()

print(resp.json())

响应参数

该接口成功时返回空对象({}),响应体中不包含业务字段。

响应示例

状态码: 200

{}

失败响应

该接口需要用户访问令牌,未认证或令牌无效时返回 401。错误响应字段名以后端实际返回为准,示例如下:

401 未认证

{
  "error": "unauthorized",
  "message": "缺少或无效的访问令牌"
}

HTTP 响应状态码

状态码 说明
200 成功(OK)
401 需要认证(Requires authentication)
403 禁止访问(Forbidden)
404 资源不存在(Not Found)

错误码

错误码 说明
401 未认证或凭证无效(缺少/无效的访问凭证)
403 无权限执行该操作
404 请求路径不存在
429 请求过于频繁,触发限流
500 系统内部错误

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