Handle pull request testing¶
POST /api/v5/repos/{owner}/{repo}/pulls/{number}/test
This endpoint handles testing for a specific pull request in the specified repository. It supports forcing the test to pass through the force parameter (this capability is only available to administrators), and a successful test returns an empty object as the response.
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 of the repository (the address path of an organization or user) |
repo |
path | string | Yes | Repository path (path) |
number |
path | integer | Yes | Ordinal number of the pull request in this repository |
access_token |
query | string | Yes | User authorization code |
Request Body:
The request body is a JSON object with the optional field force:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"force": {
"description": "Whether to force the test to pass (default: no); only available to administrators",
"type": "boolean",
"default": false
}
}
}
Response parameters¶
A successful response returns HTTP 200 with an empty object {} as the response body and no business fields.
Error response¶
Callers need to understand the shape of error responses so that they can write error handling. For this endpoint, the actual error field names returned by the backend take precedence; common failures are as follows:
401 Unauthenticated
400 Invalid parameters
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
401 |
Requires authentication |
403 |
Forbidden |
404 |
Not found |
Request example¶
Parameter description¶
The placeholders in the example are described below:
Replace
<owner>with the namespace address of the repository (the address path of an enterprise, organization, or user); replace<repo>with the repository path (path); replace<number>with the ordinal number of the pull request; replace<token>with your AtomGit user access token.
cURL¶
curl -X POST 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/test?access_token=<token>' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"force": true}'
JavaScript¶
// Native fetch (Node.js 18+ / browsers)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/test?access_token=<token>", {
method: "POST",
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({ force: 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>/test",
params={"access_token": "<token>"},
json={"force": True},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing or invalid access credentials) |
400 |
Invalid parameters or the request cannot be parsed |
404 |
The request path does not exist |
405 |
Request method not supported |
429 |
Too many requests; the rate limit is triggered |
500 |
Internal system error |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc