Manage Event Subscriptions

This page details how to retrieve, add and delete event subscriptions from a webhook.

Events send a notification to your webhook endpoint when something happens on your programme. Events occur when an API resource changes state, and their data field shows the resource’s state at that moment. You can retrieve events through API endpoints or set up webhooks to get Event objects sent to your server.

Get Event Subscriptions

The Get Event Subscriptions endpoint enables you to retrieve the events subscribed to a webhook, with the webhook ID specified in the URL. You can retrieve a webhook's event subscriptions by making a GET request to the Get Event Subscriptions endpoint, including the webhookId in the URL. For example:

https://thredd.webhook.management/api/v1/Webhooks/{webhook_id}/subscriptions

If successful, a 200 response is returned and the response will list all event subscriptions associated with the webhook.

For example:

{
"status": "success",
"response" : {
  "webhookId":"12345666",
   content: [
   {
      "eventCode" : 101,
      "description" :"Fraud Alert"
   }
 }

👍

More Information

Add Event Subscriptions

The Add Event Subscriptions endpoint enables you to add additional event codes to a webhook, with the webhook ID specified in the URL. You can add event subscriptions to a webhook by making a PUT request to the Add Event Subscriptions endpoint, including the webhookId in the URL. For example:

https://thredd.webhook.management/api/v1/Webhooks/{webhook_id}/subscriptions

The body should include the unique event identifiers you want to add to the webhook. For example:

 {
    "events" : [101,102]
 }

If successful, a 200 response is returned confirming that the webhook events have been updated.

{
"status": "success",
"response" : {
  "webhookId" : "uniqueWebhookId",
  "responseStatus" : "Webhook events updated"
}

👍

More Information

Delete Event Subscription

The Delete Event Subscription endpoint enables you to delete event subscriptions from a webhook, with the webhook ID specified in the URL. You can delete event subscriptions from a webhook by making a DELETE request to the Delete Event Subscriptions endpoint, including the webhookId and eventCode in the URL. For example:

https://thredd.webhook.management/api/v1/Webhooks/{webhookId}/subscriptions/{eventCode}

If successful, a 204 response is returned and the event code specified in the URL will be deleted from the webhook.

👍

More Information