Assign users to test a pull request¶
POST /api/v5/repos/{owner}/{repo}/pulls/{number}/testers
This endpoint assigns testers to a pull request in a specified repository. Testers are set through the tester list in the request body, and you can overwrite or add testers (controlled by the add parameter). On success, it returns the current list of tester user information.
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 organization or individual) |
repo |
path | string | Yes | Repository path (path) |
number |
path | integer | Yes | The number of the PR, that is, the ordinal number of the PR in this repository |
access_token |
query | string | Yes | User authorization code |
Request Body:
The request body is a JSON object. The fields are described below:
{
"$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"
},
"add": {
"description": "Whether to add testers. When true, testers are added instead of overwritten. Default: false.",
"type": "boolean",
"default": false
}
},
"required": ["testers"]
}
Response parameters¶
The response is an array, and each element is a tester (user) object.
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
integer | Yes | No | User ID |
login |
string | Yes | No | User name (login name) |
name |
string | Yes | Yes | User nickname |
avatar_url |
string | Yes | Yes | URL of the user's avatar |
user object
Each tester object in the array may also contain the following fields (subject to what is actually returned):
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
url |
string | No | Yes | URL of the user's profile |
html_url |
string | No | Yes | URL of the user's HTML profile |
remark |
string | No | Yes | Remark |
followers_url |
string | No | Yes | URL of the followers list |
following_url |
string | No | Yes | URL of the following list |
gists_url |
string | No | Yes | URL of the Gists list |
starred_url |
string | No | Yes | URL of the starred list |
subscriptions_url |
string | No | Yes | URL of the subscriptions list |
organizations_url |
string | No | Yes | URL of the organizations list |
repos_url |
string | No | Yes | URL of the repositories list |
events_url |
string | No | Yes | URL of the events list |
received_events_url |
string | No | Yes | URL of the received events list |
type |
string | No | Yes | User type |
permission |
string | No | Yes | Permission |
object_id |
string | No | Yes | Object ID |
email |
string | No | Yes |
Error responses¶
400 Invalid parameters
401 Unauthenticated
404 Resource not found
The error field names above are subject to what the backend actually returns.
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
401 |
Requires authentication |
403 |
Forbidden |
404 |
Resource not found |
Request example¶
Parameter description¶
Replace
<owner>with the namespace address the repository belongs to (the address path of an organization or individual); replace<repo>with the repository path (path); replace<number>with the PR number; replace<token>with your AtomGit user access token.
cURL¶
curl -X POST '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": "username1,username2", "add": true}'
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: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
},
body: JSON.stringify({
testers: "username1,username2",
add: true,
}),
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
resp = requests.post(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/testers",
params={"access_token": "<token>"},
json={
"testers": "username1,username2",
"add": True,
},
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
[
{
"id": 43,
"login": "green",
"name": "green",
"avatar_url": "https://api.atomgit.com/avatar.png"
},
{
"id": 452,
"login": "zhanghq2",
"name": "zhanghq2",
"avatar_url": "https://api.atomgit.com/avatar.png"
}
]
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing/invalid access credentials) |
400 |
Invalid parameters or unparseable request |
404 |
Request path or resource not found |
405 |
Request method not supported |
429 |
Too many requests, rate limit triggered |
500 |
Internal server error |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc