summaryrefslogtreecommitdiff
path: root/doc/api/system_hooks.md
blob: f9637d8a6c4c18bd8906897dd237bc3cf82b6289 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# System hooks

All methods require admin authorization.

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:

- **none**

```json
[
  {
    "id": 3,
    "url": "http://example.com/hook",
    "created_at": "2013-10-02T10:15:31Z"
  }
]
```

## Add new system hook hook

```
POST /hooks
```

Parameters:

- `url` (required) - The hook URL

## Test system hook

```
GET /hooks/:id
```

Parameters:

- `id` (required) - The ID of hook

```json
{
  "event_name": "project_create",
  "name": "Ruby",
  "path": "ruby",
  "project_id": 1,
  "owner_name": "Someone",
  "owner_email": "example@gitlabhq.com"
}
```

## Delete system hook

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:

- `id` (required) - The ID of hook