Get the issues associated with a pull request¶
GET /api/v5/repos/{owner}/{repo}/pulls/{number}/issues
This endpoint retrieves the list of issues associated with a pull request (PR) in the specified repository and returns detailed data for each issue, including its number, title, state, body, creator information, label list, and creation, update, and close times.
Access token support¶
- AtomGit user access tokens (AtomGit user access tokens)
Whether anonymous access is allowed¶
This endpoint allows 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 enterprise, organization, or personal namespace) |
repo |
path | string | Yes | Repository path (path) |
number |
path | integer | Yes | Which PR, that is, the ordinal number of the PR in this repository |
access_token |
query | string | No | User authorization code |
page |
query | integer | No | Current page number; defaults to 1 |
per_page |
query | integer | No | Number of items per page, up to 100; defaults to 20 |
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
number |
string | Yes | — | Issue number |
title |
string | Yes | — | Issue title |
state |
string | Yes | — | Issue state |
url |
string | Yes | — | API URL of the issue |
body |
string | Yes | — | Issue body |
user |
object | Yes | — | Information about the user who created the issue |
labels |
object[] | Yes | — | Label list of the issue |
issue_created_at |
string | Yes | No | Issue creation time |
issue_updated_at |
string | Yes | No | Issue update time |
issue_closed_at |
string | Yes | Yes | Issue close time; null if the issue is not closed |
Note: The response body is an array of issue objects; the table above describes the structure of each element in the array.
user object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
user.id |
string | Yes | — | User ID |
user.login |
string | Yes | — | User login name |
user.name |
string | Yes | — | User name |
labels object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
labels.id |
integer | Yes | — | Label ID |
labels.name |
string | Yes | — | Label name |
labels.color |
string | Yes | — | Label color |
labels.created_at |
string | Yes | — | Time the label was added |
labels.updated_at |
string | Yes | — | Label update time |
Error responses¶
Besides the success response, callers also need to know the shape of failure responses so that they can write error handling logic. The error response shapes below are general conventions; the error field names are subject to what the backend actually returns.
400 Bad request
{
"error": "invalid_request",
"message": "The number parameter cannot be empty",
"field": "number"
}
401 Unauthenticated
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
401 |
Authentication required (Requires authentication) |
403 |
Forbidden (Forbidden) |
404 |
Resource does not exist (Not found) |
405 |
Request method not supported (Method not allowed) |
429 |
Too many requests; rate limit triggered (Too many requests) |
500 |
Internal system error (Internal server error) |
Request example¶
Parameter descriptions¶
<owner>is replaced with the namespace address the repository belongs to (the address path of an enterprise, organization, or personal namespace);<repo>is replaced with the repository path (path);<number>is replaced with the PR number (which PR, that is, the ordinal number of the PR in this repository);<token>is replaced with your AtomGit user access token (this endpoint allows anonymous access, so the token is optional).
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/issues?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/repos/<owner>/<repo>/pulls/<number>/issues?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/repos/<owner>/<repo>/pulls/<number>/issues",
params={"page": 1, "per_page": 20},
headers={
"Accept": "application/json",
},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Note: This endpoint allows anonymous access; you can also pass access_token (?access_token=<token>) to retrieve the complete data visible with authorization.
Response example¶
Status code: 200
[
{
"number": "1",
"title": "Run stability tests",
"state": "open",
"url": "https://api.atomgit.com/api/v5/repos/sytest/paopao/issues/1",
"body": "What problem occurred?",
"user": {
"id": "681",
"login": "test",
"name": "test"
},
"labels": [
{
"id": 381445,
"name": "help wanted",
"color": "#008672",
"created_at": "2024-01-01T09:00:00Z",
"updated_at": "2024-01-01T09:00:00Z"
}
],
"issue_created_at": "2024-01-01T10:00:00Z",
"issue_updated_at": "2024-01-02T10:00:00Z",
"issue_closed_at": null
}
]
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing/invalid access credentials) |
400 |
Parameter error or the request cannot be parsed |
404 |
Request path 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