Enterprise pull request list¶
GET /api/v5/enterprises/*/pull_requests
This endpoint queries the pull request list of a specified enterprise (namespace). It supports filtering by state, author, target branch, labels, and time range, and lets you paginate and sort the results. The returned list includes details such as titles, branch information, labels, and the merging user.
Access token support¶
- AtomGit user access tokens
Anonymous access allowed¶
This endpoint allows anonymous access.
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
enterprise |
path | string | Yes | Enterprise path (path/login) |
state |
query | string | No | Pull Request state. Enum: all all; open open; closed closed; merged merged |
issue_number |
query | integer | No | Global issue ID |
sort |
query | string | No | Sort field. Enum: created creation time; updated update time. Defaults to creation time (created) |
direction |
query | string | No | Sort direction. Enum: asc ascending; desc descending |
page |
query | integer | No | Current page number, default 1 |
per_page |
query | integer | No | Number of items per page, maximum 100, default 20 |
base |
query | string | No | Target branch |
author |
query | string | No | Pull Request author |
search |
query | string | No | Fuzzy search by title and description |
created_after |
query | string | No | Return merge requests created after the specified time. The time must be in ISO 8601 format, for example: 2024-11-20T13:00:21+08:00 |
created_before |
query | string | No | Return merge requests created before the specified time. The time must be in ISO 8601 format, for example: 2024-11-20T13:00:21+08:00 |
updated_before |
query | string | No | Return merge requests updated before the specified time. The time must be in ISO 8601 format, for example: 2024-11-20T13:00:21+08:00 |
updated_after |
query | string | No | Return merge requests updated after the specified time. The time must be in ISO 8601 format, for example: 2024-11-20T13:00:21+08:00 |
labels |
query | string | No | Filter by the specified label names; separate multiple names with commas |
scope |
query | string | No | Filter scope. Enum: all all; created_by_me created by me; assigned_to_me assigned to me; need_my_approve requires my approval; need_my_review requires my review |
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
integer | Yes | No | Pull Request id |
title |
string | Yes | No | Pull Request title |
url |
string | Yes | No | API access URL of the pull request |
html_url |
string | Yes | No | Web page URL of the pull request |
number |
integer | Yes | No | Pull Request number |
state |
string | Yes | No | Pull Request state |
assignees_number |
integer | Yes | No | Number of reviewers |
testers_number |
integer | Yes | No | Number of testers |
assignees |
string[] | Yes | No | Reviewer list |
head |
object | Yes | No | Source branch information (the branch the changes come from) |
base |
object | Yes | No | Target branch information |
created_at |
string | Yes | No | Creation time |
updated_at |
string | Yes | No | Update time |
labels |
object[] | Yes | No | Label list |
merged_at |
string | Yes | No | Merge time |
visibility_reason |
string | No | Yes | Visibility. Enum: public publicly visible; other visible only to project members |
merged_by |
object | No | Yes | Merged by |
head object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
head.ref |
string | Yes | No | Source branch name |
head.sha |
string | Yes | No | SHA of the latest commit on the source branch |
head.repo |
object | Yes | No | Repository containing the source branch |
head.repo object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
head.repo.path |
string | Yes | No | Repository path (path) |
head.repo.namespace |
object | Yes | No | Namespace the repository belongs to |
head.repo.assigner |
object | Yes | No | Repository owner (repository assigner) |
head.repo.namespace object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
head.repo.namespace.path |
string | Yes | No | Namespace path (path) |
head.repo.assigner object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
head.repo.assigner.id |
string | Yes | No | Unique user identifier |
head.repo.assigner.login |
string | Yes | No | User name (login name) |
head.repo.assigner.name |
string | Yes | No | User nickname |
base object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
base.ref |
string | Yes | No | Target branch name |
base.sha |
string | Yes | No | SHA of the latest commit on the target branch |
base.repo |
object | Yes | No | Repository containing the target branch |
base.repo object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
base.repo.path |
string | Yes | No | Repository path (path) |
base.repo.namespace |
object | Yes | No | Namespace the repository belongs to |
base.repo.namespace object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
base.repo.namespace.path |
string | Yes | No | Namespace path (path) |
labels object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
labels.id |
integer | Yes | No | Label id |
labels.name |
string | Yes | No | Label name |
labels.color |
string | Yes | No | Label color |
labels.created_at |
string | Yes | No | Label creation time |
labels.updated_at |
string | Yes | No | Label update time |
merged_by object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
merged_by.id |
string | Yes | No | Unique user identifier |
merged_by.login |
string | Yes | No | User name (login name) |
merged_by.name |
string | Yes | No | User nickname |
merged_by.avatar_url |
string | Yes | No | URL of the user's avatar |
merged_by.html_url |
string | Yes | No | URL of the user's profile |
Error responses¶
401 Unauthenticated
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
401 |
Requires authentication |
403 |
Forbidden |
404 |
The enterprise or repository does not exist |
Request example¶
Parameter description¶
Replace
<enterprise>with the enterprise path (the address path of an enterprise, organization, or individual); this endpoint allows anonymous access, and you can also pass an AtomGit user access token.
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/enterprises/<enterprise>/pull_requests?state=open&page=1&per_page=20' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch(
"https://api.atomgit.com/api/v5/enterprises/<enterprise>/pull_requests?state=open&page=1&per_page=20",
{
headers: {
"Accept": "application/json",
},
}
);
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
resp = requests.get(
"https://api.atomgit.com/api/v5/enterprises/<enterprise>/pull_requests",
params={"state": "open", "page": 1, "per_page": 20},
headers={
"Accept": "application/json",
},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
[
{
"id": 71020,
"title": "fix: resolve login bug",
"url": "https://api.atomgit.com/api/v5/repos/test/test/1",
"html_url": "https://api.atomgit.com/test/test/1",
"number": 1,
"state": "merged",
"assignees_number": 0,
"testers_number": 0,
"assignees": [],
"head": {
"ref": "main",
"sha": "d874402d259744a00121c2cff0febc8554339aef",
"repo": {
"path": "test",
"namespace": {
"path": "repo-dev"
},
"assigner": {
"id": "uuid",
"login": "octocat",
"name": "octocat"
}
}
},
"base": {
"ref": "master",
"sha": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
"repo": {
"path": "test",
"namespace": {
"path": "repo-dev"
}
}
},
"created_at": "2024-04-15T18:33:01+08:00",
"updated_at": "2024-04-15T18:33:01+08:00",
"labels": [
{
"id": 1,
"name": "enhancement",
"color": "#0e8a16",
"created_at": "2024-04-15T18:33:01+08:00",
"updated_at": "2024-04-15T18:33:01+08:00"
}
],
"merged_at": "2024-04-15T18:33:01+08:00",
"visibility_reason": "public",
"merged_by": {
"id": "uuid",
"login": "octocat",
"name": "octocat",
"avatar_url": "https://api.atomgit.com/avatar.png",
"html_url": "https://api.atomgit.com/octocat"
}
}
]
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing/invalid access credentials) |
403 |
Forbidden (no permission to access the enterprise resource) |
404 |
The enterprise or resource does not exist |
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