gitlab-org--gitlab-foss/doc/api/system_hooks.md

71 lines
1,001 B
Markdown
Raw Normal View History

2014-05-27 08:12:15 -04:00
# System hooks
All methods require admin authorization.
2014-04-24 18:48:22 -04:00
The URL endpoint of the system hooks can be configured in [the admin area under hooks](/admin/hooks).
## List system hooks
Get list of system hooks
```
GET /hooks
```
Parameters:
2014-04-24 18:48:22 -04:00
- **none**
```json
[
{
2014-04-05 02:36:47 -04:00
"id": 3,
"url": "http://example.com/hook",
"created_at": "2013-10-02T10:15:31Z"
}
]
```
## Add new system hook hook
```
POST /hooks
```
Parameters:
2014-04-24 18:48:22 -04:00
- `url` (required) - The hook URL
## Test system hook
```
GET /hooks/:id
```
Parameters:
2014-04-24 18:48:22 -04:00
- `id` (required) - The ID of hook
```json
{
2014-04-05 02:36:47 -04:00
"event_name": "project_create",
"name": "Ruby",
"path": "ruby",
"project_id": 1,
"owner_name": "Someone",
"owner_email": "example@gitlabhq.com"
}
```
## Delete system hook
2014-08-15 10:03:01 -04:00
Deletes a system hook. This is an idempotent API function and returns `200 OK` even if the hook is not available. If the hook is deleted it is also returned as JSON.
```
DELETE /hooks/:id
```
Parameters:
2014-04-24 18:48:22 -04:00
- `id` (required) - The ID of hook