Get the list of branches associated with an Issue¶
GET /api/v5/repos/{owner}/{repo}/issues/{number}/related_branches
This endpoint retrieves the list of branches associated with a specified Issue. Query by the namespace address that owns the repository, the repository path, and the Issue number to return the branch names associated with the Issue. The response body is an array of strings, where each element corresponds to a branch name.
Access token support¶
- 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 | Address path of the namespace that owns the repository (the address path of an organization or individual) |
repo |
path | string | Yes | Repository path (path) |
number |
path | string | Yes | Issue number (case-sensitive; no need to add the # sign) |
Response parameters¶
The response body is an array of strings; each element in the array is the name of a branch associated with the Issue.
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
| (Response body) | string[] | Yes | No | List of branch names associated with the Issue |
Error responses¶
This endpoint has no business-level error responses. When a request fails, it returns the corresponding HTTP status code and error information. The error field names are subject to the actual backend response.
HTTP status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
404 |
Resource not found (Not found) |
500 |
Internal server error (Internal server error) |
Request example¶
Parameter notes¶
The placeholders in the example are described below:
<owner>— replace with the address path of the namespace that owns the repository (the address path of an organization or individual);<repo>— replace with the repository path (path);<number>— replace with the Issue number (case-sensitive; no need to add the # sign).
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/issues/<number>/related_branches' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const owner = "<owner>";
const repo = "<repo>";
const number = "<number>";
const response = await fetch(
`https://api.atomgit.com/api/v5/repos/${owner}/${repo}/issues/${number}/related_branches`,
{ 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
owner = "<owner>"
repo = "<repo>"
number = "<number>"
resp = requests.get(
f"https://api.atomgit.com/api/v5/repos/{owner}/{repo}/issues/{number}/related_branches",
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
Error codes¶
| Error code | Description |
|---|---|
404 |
Resource not found |
500 |
Internal server error |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc