1
1
# System hooks
2
2
3
- All methods require admin authorization.
3
+ All methods require administrator authorization.
4
4
5
5
The URL endpoint of the system hooks can also be configured using the UI in
6
- the admin area under hooks(` /admin/hooks ` ).
6
+ the admin area under ** Hooks** (` /admin/hooks ` ).
7
+
8
+ Read more about [ system hooks] ( ../system_hooks/system_hooks.md ) .
7
9
8
10
## List system hooks
9
11
10
12
Get a list of all system hooks.
11
13
14
+ ---
15
+
12
16
```
13
17
GET /hooks
14
18
```
15
19
20
+ Example request:
21
+
16
22
``` bash
17
23
curl -H " PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/hooks
18
24
```
@@ -31,6 +37,10 @@ Example response:
31
37
32
38
## Add new system hook
33
39
40
+ Add a new system hook.
41
+
42
+ ---
43
+
34
44
```
35
45
POST /hooks
36
46
```
@@ -39,6 +49,8 @@ POST /hooks
39
49
| --------- | ---- | -------- | ----------- |
40
50
| ` url ` | string | yes | The hook URL |
41
51
52
+ Example request:
53
+
42
54
``` bash
43
55
curl -X POST -H " PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" " https://gitlab.example.com/api/v3/hooks?url=https://gitlab.example.com/hook"
44
56
```
@@ -65,6 +77,8 @@ GET /hooks/:id
65
77
| --------- | ---- | -------- | ----------- |
66
78
| ` id ` | integer | yes | The ID of the hook |
67
79
80
+ Example request:
81
+
68
82
``` bash
69
83
curl -H " PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/hooks/2
70
84
```
@@ -85,8 +99,12 @@ Example response:
85
99
## Delete system hook
86
100
87
101
Deletes a system hook. This is an idempotent API function and returns ` 200 OK `
88
- even if the hook is not available. If the hook is deleted a JSON object is
89
- returned.
102
+ even if the hook is not available.
103
+
104
+ If the hook is deleted, a JSON object is returned. An error is raised if the
105
+ hook is not found.
106
+
107
+ ---
90
108
91
109
```
92
110
DELETE /hooks/:id
@@ -96,6 +114,8 @@ DELETE /hooks/:id
96
114
| --------- | ---- | -------- | ----------- |
97
115
| ` id ` | integer | yes | The ID of the hook |
98
116
117
+ Example request:
118
+
99
119
``` bash
100
120
curl -X DELETE -H " PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/hooks/2
101
121
```
0 commit comments