Get all commit information for a specific pull request¶
GET /api/v5/repos/{owner}/{repo}/pulls/{number}/commits
This endpoint retrieves all commits of a specific pull request in the specified repository. The response includes the commit SHA, the commit message, author and committer information, parent commit information, and the list of co-authors. Pagination is supported.
Supported access tokens¶
- AtomGit user access token (AtomGit user access tokens)
Anonymous access¶
This endpoint allows 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, for example 0 |
page |
query | string | No | Current page number |
per_page |
query | string | No | Number of items per page |
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
sha |
string | Yes | — | Commit SHA |
html_url |
string | Yes | — | HTML URL of the commit |
commit |
object | Yes | — | Commit information |
author |
object | Yes | — | Commit author information |
committer |
object | Yes | — | Committer information |
parents |
object | Yes | — | Parent commit information |
co_authors |
object[] | Yes | — | List of co-authors |
commit object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
commit.author |
object | Yes | — | Commit author information |
commit.committer |
object | Yes | — | Committer information |
commit.message |
string | Yes | — | Commit message |
commit.author object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
commit.author.login |
string | No | — | Login name |
commit.author.name |
string | Yes | — | Name |
commit.author.email |
string | Yes | — | |
commit.author.date |
string | Yes | — | Commit date |
commit.committer object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
commit.committer.login |
string | No | — | Login name |
commit.committer.name |
string | Yes | — | Name |
commit.committer.email |
string | Yes | — |
author object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
author.id |
string | Yes | — | User ID |
author.login |
string | Yes | — | Login name |
author.name |
string | Yes | — | Name |
author.avatar_url |
string | Yes | — | Avatar URL |
author.html_url |
string | Yes | — | Homepage URL |
author.object_id |
string | Yes | — | Object ID |
committer object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
committer.id |
string | Yes | — | User ID |
committer.login |
string | Yes | — | Login name |
committer.name |
string | Yes | — | Name |
committer.avatar_url |
string | Yes | — | Avatar URL |
committer.html_url |
string | Yes | — | Homepage URL |
committer.object_id |
string | Yes | — | Object ID |
parents object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
parents.sha |
string | Yes | — | SHA of the parent commit |
parents.shas |
string[] | Yes | — | List of parent commit SHAs |
co_authors array element object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
co_authors.id |
string | Yes | — | User ID |
co_authors.login |
string | Yes | — | Login name |
co_authors.name |
string | Yes | — | Name |
co_authors.avatar_url |
string | Yes | — | Avatar URL |
co_authors.html_url |
string | Yes | — | Homepage URL |
co_authors.email |
string | Yes | — |
Error response¶
The endpoint may return the following error status codes. Error field names are as actually returned by the backend.
400 Invalid parameters
401 Unauthenticated
404 Not found
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
304 |
Not modified |
401 |
Requires authentication |
403 |
Forbidden |
404 |
Not found |
Request example¶
Parameter description¶
This endpoint allows anonymous access, so no access token is required. To call it with higher permissions, you can also append access_token=<token> to the query parameters.
Replace
<owner>with the namespace address of the repository (the address path of an organization or user),<repo>with the repository path,<number>with the ordinal number of the pull request in this repository, and<token>with your AtomGit user access token.
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/commits?page=1&per_page=30' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browsers)
const response = await fetch(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/commits?page=1&per_page=30",
{
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/repos/<owner>/<repo>/pulls/<number>/commits",
params={"page": 1, "per_page": 30},
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
[
{
"sha": "91861a9668041fc1c0ff51d1db66b6297179f5e6",
"html_url": "https://api.atomgit.com/sytest/paopao/blob/91861a9668041fc1c0ff51d1db66b6297179f5e6",
"commit": {
"author": {
"login": "test",
"name": "test",
"email": "test@test.com",
"date": "2024-03-28T11:19:33+08:00"
},
"committer": {
"login": "test",
"name": "test",
"email": "test@test.com"
},
"message": "!5 333 * add 1/2/3/4. * add 1/2/3. "
},
"author": {
"id": "id123",
"login": "test",
"name": "test",
"avatar_url": "https://api.atomgit.com/pic.png",
"html_url": "https://api.atomgit.com/test"
},
"committer": {
"id": "id123",
"login": "test",
"name": "test",
"avatar_url": "https://api.atomgit.com/pic.png",
"html_url": "https://api.atomgit.com/test"
},
"parents": {
"sha": "2e208a1e38f6a5a7b0cc3787688067ba082a8bb7",
"shas": [
"2e208a1e38f6a5a7b0cc3787688067ba082a8bb7"
]
},
"co_authors": [
{
"id": "id123",
"login": "test",
"name": "test",
"avatar_url": "https://api.atomgit.com/pic.png",
"html_url": "https://api.atomgit.com/test",
"email": "test@test.com"
}
]
}
]
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 or the resource was not found |
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