Cancel the review of a pull request by users¶
DELETE /api/v5/repos/{owner}/{repo}/pulls/{number}/reviewers
Cancels user reviews of a pull request in the specified repository. By passing a list of personal namespace addresses of the users whose reviews should be cancelled, the corresponding reviewers are removed, and the updated reviewer information array is returned when the operation completes.
Supported access tokens¶
- AtomGit user access token (AtomGit user access tokens)
Anonymous access¶
This endpoint does not allow anonymous access.
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
owner |
path | string | Yes | Namespace address to which the repository belongs (address path of the enterprise, organization, or user) |
repo |
path | string | Yes | Repository path (path) |
number |
path | string | Yes | Which PR it is, that is, the ordinal number of the PR in this repository, corresponding to iid |
access_token |
query | string | Yes | User authorization code |
Request Body:
The request body is a JSON object containing the list of users whose reviews should be cancelled:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"reviewers": {
"description": "Personal namespace addresses of users, separated by commas",
"type": "string"
}
},
"required": ["reviewers"]
}
Response parameters¶
The response body is an array of reviewer (user) information.
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
reviewer |
object | Yes | No | Reviewer (user) information (array element) |
reviewer object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
reviewer.id |
integer | Yes | No | User ID |
reviewer.login |
string | Yes | No | Account |
reviewer.name |
string | Yes | No | Nickname |
reviewer.avatar_url |
string | No | Yes | Avatar |
reviewer.object_id |
string | Yes | No | Object ID |
Error response¶
The following are examples of error responses the endpoint may return:
400 Invalid parameters
401 Unauthenticated
404 Not found
Note: Error response field names follow what the backend actually returns.
HTTP status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
400 |
Parameter error (Bad request) |
401 |
Authentication required (Requires authentication) |
404 |
Resource does not exist (Not found) |
Request example¶
Parameter notes¶
- replace
<owner>with the namespace address to which the repository belongs (address path of the enterprise, organization, or user); - replace
<repo>with the repository path (path); - replace
<number>with which PR it is (the ordinal number of the PR in this repository, that is,iid); - replace
<token>with your AtomGit user access token; - replace
reviewerswith the personal namespace addresses of the users whose reviews should be cancelled, separated by commas when there are several.
cURL¶
curl -X DELETE 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/reviewers?access_token=<token>' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"reviewers": "user1,user2"}'
JavaScript¶
// Native fetch (Node.js 18+ / browsers)
const response = await fetch(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/reviewers?access_token=<token>",
{
method: "DELETE",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
},
body: JSON.stringify({ reviewers: "user1,user2" }),
}
);
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
resp = requests.delete(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/reviewers",
params={"access_token": "<token>"},
json={"reviewers": "user1,user2"},
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
[
{
"id": 1,
"login": "octocat",
"name": "Octo Cat",
"avatar_url": "https://api.atomgit.com/avatar.png",
"object_id": "user-123"
}
]
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing or invalid access credentials) |
400 |
Invalid parameters or unparseable request |
404 |
The requested resource does not exist |
405 |
Request method not supported |
429 |
Too many requests; rate limit triggered |
500 |
Internal system error |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc