Get a single repository webhook¶
GET /api/v5/repos/{owner}/{repo}/hooks/{id}
This endpoint retrieves the configuration details of a single webhook in the specified repository, including the callback URL, subscribed event types, result of the most recent push, and active status.
Supported access tokens¶
- AtomGit user access token (AtomGit user access tokens)
Anonymous access¶
This endpoint does not allow 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 enterprise, organization, or individual) |
repo |
path | string | Yes | Repository path (path) |
id |
path | integer | Yes | Webhook ID |
access_token |
query | string | Yes | User authorization code |
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
integer | Yes | No | Webhook ID |
url |
string | Yes | Yes | Webhook callback URL |
password |
string | Yes | Yes | Password corresponding to the webhook callback URL (secret token) |
result |
string | Yes | Yes | Result of the most recent push, may be null |
project_id |
integer | Yes | No | ID of the repository the webhook belongs to |
result_code |
integer | Yes | Yes | Status code returned by the most recent push |
push_events |
boolean | Yes | Yes | Whether push events are subscribed |
tag_push_events |
boolean | Yes | Yes | Whether tag push events are subscribed |
issues_events |
boolean | Yes | Yes | Whether issue events are subscribed |
note_events |
boolean | Yes | Yes | Whether comment (note) events are subscribed |
merge_requests_events |
boolean | Yes | Yes | Whether merge request events are subscribed |
created_at |
string | Yes | Yes | Creation time |
active |
boolean | Yes | Yes | Whether activated |
Error response¶
401 Unauthenticated
404 Not found
403 Forbidden
{
"message": "You do not have permission to access the webhook of this repository",
"error": "forbidden"
}
HTTP status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
401 |
Requires authentication |
403 |
Forbidden |
404 |
Not found |
Request example¶
Parameter description¶
Replace
<owner>with the address path of the namespace that owns the repository (the address path of an enterprise, organization, or individual); replace<repo>with the repository path (path); replace<id>with the webhook ID; replace<token>with your AtomGit user access token.
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/hooks/<id>?access_token=<token>' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const token = "<YOUR-TOKEN>";
const owner = "<owner>";
const repo = "<repo>";
const id = "<id>";
const response = await fetch(
`https://api.atomgit.com/api/v5/repos/${owner}/${repo}/hooks/${id}?access_token=${token}`,
{
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
token = "<YOUR-TOKEN>"
owner = "<owner>"
repo = "<repo>"
webhook_id = "<id>"
resp = requests.get(
f"https://api.atomgit.com/api/v5/repos/{owner}/{repo}/hooks/{webhook_id}",
params={"access_token": token},
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
{
"id": 9529,
"url": "https://api.atomgit.com/hook/callback",
"password": "123445",
"result": null,
"project_id": 282463,
"result_code": 0,
"push_events": false,
"tag_push_events": false,
"issues_events": true,
"note_events": false,
"merge_requests_events": true,
"created_at": "2024-09-26T16:13:27+08:00",
"active": true
}
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing or invalid access token) |
403 |
Forbidden (no permission to access this resource) |
404 |
Request path does not exist (or the webhook does not exist) |
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