Add documentation for webhooks API
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
fc78e532b8
commit
e79b26a3b4
2 changed files with 90 additions and 1 deletions
|
@ -1751,3 +1751,92 @@ Note that this differs from the Mastodon API variant: Mastodon API only returns
|
||||||
```json
|
```json
|
||||||
{}
|
{}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## `GET /api/v1/pleroma/admin/webhooks`
|
||||||
|
|
||||||
|
### List webhooks
|
||||||
|
|
||||||
|
- Method: `GET`
|
||||||
|
- Response:
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"enabled": true,
|
||||||
|
"id": "2",
|
||||||
|
"events": ["account.created"],
|
||||||
|
"url": "https://webhook.example/",
|
||||||
|
"secret": "eb85d4ccd8510e78f912743949dc354e8146987d",
|
||||||
|
"updated_at": "2022-10-29T17:44:16.000Z",
|
||||||
|
"created_at": "2022-10-29T17:44:13.000Z"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
## `GET /api/v1/pleroma/admin/webhooks/:id`
|
||||||
|
|
||||||
|
### Get an individual webhook
|
||||||
|
|
||||||
|
- Method: `GET`
|
||||||
|
- Params:
|
||||||
|
- `id`: **string** Webhook ID
|
||||||
|
- Response: A webhook
|
||||||
|
|
||||||
|
## `POST /api/v1/pleroma/admin/webhooks`
|
||||||
|
|
||||||
|
### Create a webhook
|
||||||
|
|
||||||
|
- Method: `POST`
|
||||||
|
- Params:
|
||||||
|
- `url`: **string** Webhook URL
|
||||||
|
- *optional* `events`: **[string]** Types of events to trigger on (`account.created`, `report.created`)
|
||||||
|
- *optional* `enabled`: **boolean** Whether webhook is enabled
|
||||||
|
- Response: A webhook
|
||||||
|
|
||||||
|
## `PATCH /api/v1/pleroma/admin/webhooks/:id`
|
||||||
|
|
||||||
|
### Update a webhook
|
||||||
|
|
||||||
|
- Method: `PATCH`
|
||||||
|
- Params:
|
||||||
|
- `id`: **string** Webhook ID
|
||||||
|
- *optional* `url`: **string** Webhook URL
|
||||||
|
- *optional* `events`: **[string]** Types of events to trigger on (`account.created`, `report.created`)
|
||||||
|
- *optional* `enabled`: **boolean** Whether webhook is enabled
|
||||||
|
- Response: A webhook
|
||||||
|
|
||||||
|
## `DELETE /api/v1/pleroma/admin/webhooks/:id`
|
||||||
|
|
||||||
|
### Delete a webhook
|
||||||
|
|
||||||
|
- Method: `DELETE`
|
||||||
|
- Params:
|
||||||
|
- `id`: **string** Webhook ID
|
||||||
|
- Response: A webhook
|
||||||
|
|
||||||
|
## `POST /api/v1/pleroma/admin/webhooks/:id/enable`
|
||||||
|
|
||||||
|
### Activate a webhook
|
||||||
|
|
||||||
|
- Method: `POST`
|
||||||
|
- Params:
|
||||||
|
- `id`: **string** Webhook ID
|
||||||
|
- Response: A webhook
|
||||||
|
|
||||||
|
## `POST /api/v1/pleroma/admin/webhooks/:id/disable`
|
||||||
|
|
||||||
|
### Deactivate a webhook
|
||||||
|
|
||||||
|
- Method: `POST`
|
||||||
|
- Params:
|
||||||
|
- `id`: **string** Webhook ID
|
||||||
|
- Response: A webhook
|
||||||
|
|
||||||
|
## `POST /api/v1/pleroma/admin/webhooks/:id/rotate_secret`
|
||||||
|
|
||||||
|
### Rotate webhook signing secret
|
||||||
|
|
||||||
|
- Method: `POST`
|
||||||
|
- Params:
|
||||||
|
- `id`: **string** Webhook ID
|
||||||
|
- Response: A webhook
|
||||||
|
|
|
@ -163,7 +163,7 @@ defp webhook do
|
||||||
"id" => "1",
|
"id" => "1",
|
||||||
"url" => "https://example.com/webhook",
|
"url" => "https://example.com/webhook",
|
||||||
"events" => ["report.created"],
|
"events" => ["report.created"],
|
||||||
"secret" => "D3D8CF4BC11FD9C41FD34DCC38D282E451C8BD34",
|
"secret" => "d3d8cf4bc11fd9c41fd34dcc38d282e451c8bd34",
|
||||||
"enabled" => true,
|
"enabled" => true,
|
||||||
"created_at" => "2022-06-24T16:19:38.523Z",
|
"created_at" => "2022-06-24T16:19:38.523Z",
|
||||||
"updated_at" => "2022-06-24T16:19:38.523Z"
|
"updated_at" => "2022-06-24T16:19:38.523Z"
|
||||||
|
|
Loading…
Reference in a new issue