List repository webhooks¶
GET /api/v5/repos/{owner}/{repo}/hooks
This endpoint lists the webhooks configured for the specified repository, returning the ID, triggered event types, active status, and creation time of each webhook, and supports paginated queries.
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) |
access_token |
query | string | Yes | User authorization code |
page |
query | integer | No | Current page number, defaults to 1 |
per_page |
query | integer | No | Number of items per page, maximum 100, defaults to 20 |
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
integer | Yes | Yes | Webhook ID |
url |
string | Yes | Yes | Webhook URL |
password |
string | Yes | Yes | Webhook password |
result |
string | Yes | Yes | Test result |
project_id |
integer | Yes | Yes | ID of the repository the webhook belongs to |
result_code |
integer | Yes | Yes | Status code of the test result |
push_events |
boolean | Yes | Yes | Whether to trigger push events |
tag_push_events |
boolean | Yes | Yes | Whether to trigger tag push events |
issues_events |
boolean | Yes | Yes | Whether to trigger issue events |
note_events |
boolean | Yes | Yes | Whether to trigger comment/note events |
merge_requests_events |
boolean | Yes | Yes | Whether to trigger merge request events |
created_at |
string | Yes | Yes | Creation time |
active |
boolean | Yes | Yes | Whether activated |
Error response¶
401 Unauthenticated
The actual error field names are those returned by the backend.
HTTP status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
401 |
Requires authentication |
403 |
Forbidden |
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<token>with your AtomGit user access token.
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/hooks?access_token=<token>&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>/hooks?access_token=<token>&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>/hooks",
params={
"access_token": "<token>",
"page": 1,
"per_page": 20,
},
headers={
"Accept": "application/json",
},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
[
{
"id": 9523,
"url": "https://api.atomgit.com/webhook/example",
"password": "123445",
"result": "success",
"project_id": 282463,
"result_code": 200,
"push_events": true,
"tag_push_events": false,
"issues_events": true,
"note_events": false,
"merge_requests_events": true,
"created_at": "2024-09-18T17:51:44+08:00",
"active": true
}
]
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing or invalid access token) |
403 |
Forbidden, no permission |
404 |
Request path 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