Delete a branch¶
DELETE /api/v5/repos/{owner}/{repo}/branches/{name}
Deletes the specified branch in the specified repository. On success the target branch is removed and the response body is empty.
Supported access tokens¶
- AtomGit user access tokens
Anonymous access allowed¶
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) |
name |
path | string | Yes | Branch name |
access_token |
query | string | Yes | User authorization code |
Response parameters¶
On success this endpoint has no response body (HTTP 204/200, returning ResponseEntity<Void>) and returns no business data.
Error response¶
401 Unauthenticated
404 Resource does not exist
Error field names follow what the backend actually returns; the examples here are illustrative only.
HTTP status codes¶
| Status code | Description |
|---|---|
204 |
No Content; deletion succeeded |
200 |
Success (OK) |
401 |
Authentication required (Requires authentication) |
404 |
Branch does not exist (Not found) |
403 |
Access forbidden (Forbidden) |
Request example¶
Parameter notes¶
Replace
<owner>with the namespace address to which the repository belongs (the address path of the enterprise, organization, or user); replace<repo>with the repository path (path); replace<name>with the name of the branch to delete; replace<token>with your AtomGit user access token.
cURL¶
curl -X DELETE 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/branches/<name>?access_token=<token>' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browsers)
const response = await fetch(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/branches/<name>?access_token=<token>",
{
method: "DELETE",
headers: {
"Accept": "application/json",
},
}
);
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.text();
console.log(data);
Python¶
import requests
resp = requests.delete(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/branches/<name>?access_token=<token>",
headers={
"Accept": "application/json",
},
timeout=10,
)
resp.raise_for_status()
print(resp.text)
Response example¶
Status code: 204
On successful deletion the response body is empty (204 No Content) and no content is returned.
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing or invalid access credentials) |
404 |
Branch does not exist or the request path does not exist |
403 |
Access forbidden (no permission) |
400 |
Invalid parameters or the request cannot be parsed |
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