Set the merger of a pull request¶
PUT /api/v5/repos/{owner}/{repo}/pulls/{number}/mergers
Sets the mergers of a pull request in the specified repository. By submitting comma-separated personal namespace addresses of users, you can designate one or more mergers; on success the response returns the relevant merger information.
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:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"mergers": {
"description": "Personal namespace addresses of users, separated by commas",
"type": "string"
}
},
"required": ["mergers"]
}
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
integer | Yes | No | ID |
login |
string | Yes | No | Account |
name |
string | Yes | No | Nickname |
avatar_url |
string | No | Yes | Avatar |
object_id |
string | Yes | No | Object ID |
Note: The response body is an array of merger information objects; the fields in the table are those of each array element (a merger information object).
Error response¶
This endpoint requires authentication, and the target pull request may not exist, so the following error responses are possible (error field names follow what the backend actually returns):
400 Invalid parameters
{
"error": "invalid_request",
"message": "The parameter mergers cannot be empty",
"field": "mergers"
}
401 Unauthenticated
404 Not found
HTTP status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
400 |
Parameter error (Bad request) |
401 |
Authentication required (Requires authentication) |
403 |
Access forbidden (Forbidden) |
404 |
Not found (Not found) |
405 |
Request method not allowed (Method not allowed) |
429 |
Too many requests (Too many requests) |
500 |
Internal server error (Internal server error) |
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 (that is, the ordinal number of the PR in this repository, corresponding toiid); replace<token>with your AtomGit user access token; replace<user1>,<user2>with the mergers (personal namespace addresses of users, separated by commas).
cURL¶
curl -X PUT 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/mergers?access_token=<token>' \
-H 'Content-Type: application/json' \
-d '{"mergers": "<user1>,<user2>"}'
JavaScript¶
// Native fetch (Node.js 18+ / browsers)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/mergers?access_token=<token>", {
method: "PUT",
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
mergers: "<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.put(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/mergers",
params={"access_token": "<token>"},
headers={"Content-Type": "application/json"},
json={"mergers": "<user1>,<user2>"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
[
{
"id": 123,
"login": "octocat",
"name": "Octo Cat",
"avatar_url": "https://api.atomgit.com/avatar.png",
"object_id": "user-123"
}
]
Error codes¶
| Error code | Description |
|---|---|
400 |
Invalid parameters or unparseable request |
401 |
Unauthenticated or invalid credentials (missing or invalid access credentials) |
403 |
Access forbidden (no permission to perform this operation) |
404 |
Repository or pull request 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