Cancel a user's test for a pull request¶
DELETE /api/v5/repos/{owner}/{repo}/pulls/{number}/testers
This endpoint cancels the test user of a pull request in a specified repository. By passing the personal namespace address of the user to remove, you can delete the corresponding tester from the PR's tester list, and the remaining test user information is returned after the operation.
Access token support¶
- AtomGit user access tokens
Anonymous access allowed¶
This endpoint does not allow anonymous access.
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
owner |
path | string | Yes | The namespace address the repository belongs to (the address path of an enterprise, organization, or individual) |
repo |
path | string | Yes | Repository path (path) |
number |
path | string | Yes | The number of the PR, that is, the ordinal number of the PR in this repository, corresponding to iid |
access_token |
query | string | Yes | User authorization code |
Request Body:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"testers": {
"description": "The personal namespace addresses of the users, separated by commas",
"type": "string"
}
},
"required": ["testers"]
}
Response parameters¶
The response body is an array of test user objects. The structure of each element is as follows:
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
integer | Yes | — | User ID |
login |
string | Yes | — | Account (login name) |
name |
string | Yes | — | Nickname |
avatar_url |
string | No | — | Avatar URL |
object_id |
string | Yes | — | User object ID |
Error responses¶
The endpoint may return the following error responses (the error field names are subject to what the backend actually returns):
400 Invalid parameters
401 Unauthenticated
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
400 |
Invalid parameters (Bad request) |
401 |
Requires authentication |
404 |
Resource not found |
500 |
Internal server error |
Request example¶
Parameter description¶
The example uses the following placeholders:
Replace
<owner>with the namespace address the repository belongs to (the address path of an enterprise, organization, or individual); replace<repo>with the repository path (path); replace<number>with the PR number (corresponding to iid); replace<testers>with the personal namespace addresses of the users whose tests are to be canceled, separated by commas; replace<token>with your AtomGit user access token.
cURL¶
curl -X DELETE 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/testers?access_token=<token>' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"testers": "<testers>"}'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/testers?access_token=<token>", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
},
body: JSON.stringify({
testers: "<testers>",
}),
});
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>/testers",
params={"access_token": "<token>"},
headers={
"Content-Type": "application/json",
"Accept": "application/json",
},
json={"testers": "<testers>"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
[
{
"id": 123,
"login": "octocat",
"name": "Octocat",
"avatar_url": "https://api.atomgit.com/avatar.png",
"object_id": "f6c4f2a1"
}
]
Error codes¶
| Error code | Description |
|---|---|
400 |
Invalid parameters or unparseable request |
401 |
Unauthenticated or invalid credentials (missing/invalid access credentials) |
404 |
Request path or resource not found |
500 |
Internal server error |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc