Commit 23a878c4 authored by Achilleas Pipinellis's avatar Achilleas Pipinellis

Clean up system hooks API documentation

[ci skip]
parent 9eeda3da
# System hooks # System hooks
All methods require admin authorization. All methods require administrator authorization.
The URL endpoint of the system hooks can also be configured using the UI in The URL endpoint of the system hooks can also be configured using the UI in
the admin area under hooks(`/admin/hooks`). the admin area under **Hooks** (`/admin/hooks`).
Read more about [system hooks](../system_hooks/system_hooks.md).
## List system hooks ## List system hooks
Get a list of all system hooks. Get a list of all system hooks.
---
``` ```
GET /hooks GET /hooks
``` ```
Example request:
```bash ```bash
curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/hooks curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/hooks
``` ```
...@@ -31,6 +37,10 @@ Example response: ...@@ -31,6 +37,10 @@ Example response:
## Add new system hook ## Add new system hook
Add a new system hook.
---
``` ```
POST /hooks POST /hooks
``` ```
...@@ -39,6 +49,8 @@ POST /hooks ...@@ -39,6 +49,8 @@ POST /hooks
| --------- | ---- | -------- | ----------- | | --------- | ---- | -------- | ----------- |
| `url` | string | yes | The hook URL | | `url` | string | yes | The hook URL |
Example request:
```bash ```bash
curl -X POST -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/hooks?url=https://gitlab.example.com/hook" curl -X POST -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/hooks?url=https://gitlab.example.com/hook"
``` ```
...@@ -65,6 +77,8 @@ GET /hooks/:id ...@@ -65,6 +77,8 @@ GET /hooks/:id
| --------- | ---- | -------- | ----------- | | --------- | ---- | -------- | ----------- |
| `id` | integer | yes | The ID of the hook | | `id` | integer | yes | The ID of the hook |
Example request:
```bash ```bash
curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/hooks/2 curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/hooks/2
``` ```
...@@ -85,8 +99,12 @@ Example response: ...@@ -85,8 +99,12 @@ Example response:
## Delete system hook ## Delete system hook
Deletes a system hook. This is an idempotent API function and returns `200 OK` 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 a JSON object is even if the hook is not available.
returned.
If the hook is deleted, a JSON object is returned. An error is raised if the
hook is not found.
---
``` ```
DELETE /hooks/:id DELETE /hooks/:id
...@@ -96,6 +114,8 @@ DELETE /hooks/:id ...@@ -96,6 +114,8 @@ DELETE /hooks/:id
| --------- | ---- | -------- | ----------- | | --------- | ---- | -------- | ----------- |
| `id` | integer | yes | The ID of the hook | | `id` | integer | yes | The ID of the hook |
Example request:
```bash ```bash
curl -X DELETE -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/hooks/2 curl -X DELETE -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/hooks/2
``` ```
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment