# View webhook deliveries

See what a webhook sent in the last 30 days and what came back, and send a delivery again.

A delivery's record holds the event, the result (pending, retrying, delivered, failed), the response
code or the connection error, the time taken, the body sent and the first 4 KiB of the answer. Its
id is the `X-EWS-Delivery` header. The examples use the repository id
`5d6c2a1e-7b3f-4c8d-9e0a-1b2c3d4e5f60`, the webhook id `c3d4e5f6-a7b8-4c9d-8e0f-1a2b3c4d5e6f` and
the delivery id `0b7e2f4a-1c3d-4e5f-a6b7-c8d9e0f1a2b3`.

## Prerequisites

- Permission for `git:ListWebhooks` to read the log. It is a sensitive read: every request is
  recorded in the audit log.
- In the Deutsche Cloud Console, also `git:GetRepository` to open the repository's settings (without it the
  page is not found).
- Permission for `git:UpdateWebhook` to redeliver. The webhook must be active: redelivering
  through an inactive one is refused with 409 `The webhook is inactive; activate it first`. The
  Deutsche Cloud Console also offers no redelivery on an archived repository.

## View and redeliver

**Console**
1. In the repository, choose **Settings**, then **Webhooks**.
2. Choose the webhook's row, or **Recent deliveries** in its actions menu. The deliveries of the
   last 30 days are listed with **Result** (**Pending**, **Retrying**, **Delivered** or
   **Failed**), **Event**, **Response**, **Time taken**, **Attempts** and **Sent**.
3. Choose a delivery. Under **Request** you see the body sent, and under **Response** the status
   and the answer, or the connection error.
4. (Optional) Choose **Redeliver**.

**CLI**
```sh
dcloud git webhook-deliveries list 5d6c2a1e-7b3f-4c8d-9e0a-1b2c3d4e5f60 c3d4e5f6-a7b8-4c9d-8e0f-1a2b3c4d5e6f
dcloud git webhook-deliveries redeliver 5d6c2a1e-7b3f-4c8d-9e0a-1b2c3d4e5f60 \
  c3d4e5f6-a7b8-4c9d-8e0f-1a2b3c4d5e6f 0b7e2f4a-1c3d-4e5f-a6b7-c8d9e0f1a2b3
```

**API**
```http
POST /git/api/repositories/5d6c2a1e-7b3f-4c8d-9e0a-1b2c3d4e5f60/webhooks/c3d4e5f6-a7b8-4c9d-8e0f-1a2b3c4d5e6f/deliveries/0b7e2f4a-1c3d-4e5f-a6b7-c8d9e0f1a2b3/redeliver
```

## Result

**Redeliver** queues the same body again as a new delivery with its own id, signed with the
current secret; the API answers 202 with that id. The new delivery is listed as **Pending** until
it is sent.

## Related

- [Receive webhooks](receive-webhooks.md)
- `git.webhook-deliveries.redeliver` · `dcloud git webhook-deliveries list`
