Create and View Webhooks

This page describes how to create and view webhooks, as well as checking whether the webhook is available and responsive.

Create Webhook

The Create New Webhook endpoint enables you to register a new webhook.

You can create a new webhook by making a POST request to the Register New Webhook endpoint. For example:

https://thredd.webhook.management/api/v1/Webhooks

A webhook requires the following mandatory information in the request body:

  • Your unique program manager code
  • The URL the webhook will call

There are other fields that can be included in the request too, such as the event codes associated with the webhook.

You can find an example of a Create New Webhook request body below.

{
  "programManagerCode" : "TRD",  
  "productId": 12345,
  "events": [101],
  "webhookStatus": "active",  
  "config": {
    "url": "https://client_domain.com/webhook",
    "customHeaders": {
      "header1": "value_1",
      "header2": "value_2"
    }
  }
}

If successful, a 201 response will be returned with details on the newly registered webhook.

{
"status": "success",
"response" : {
  "webhookid" : "W000001ABC",
  "programManagerCode" : "TRD",
  "productId": 12345,
  "events": [101],
  "webhookStatus": "active",
  "config": {
    "url": "https://client_domain.com/webhook", 
    "customHeaders": {
      "header1": "value_1",
      "header2": "value_2"
    }
  },  
  "createdTime": "2024-01-24T23:20:28Z"
}

👍

More Information

List Webhooks

The List Webhooks endpoint enables you to return all webhooks associated with a program manager.

You can return webhooks for a program manager by making a GET request to the List Webhooks endpoint. For example:

https://thredd.webhook.management/api/v1/Webhooks

The request header should include the program manager code you want to return webhooks for using the X-PM-Code field. For example:

curl --request GET \
     --url https://thredd.webhook.management/api/v1/Webhooks \
     --header 'X-PM-Code: 12345' \
     --header 'accept: application/json'

If successful, a 201 response is returned with details of the webhooks associated with the program manager. See the below example response.

{
"status": "success",
"response" : { 
  "content": [
   {
      "webhookId" : "uniqueWebhookId",
      "webhookStatus": active,
      "productId": 12345,
      "events":[101,102],
      "config": {
        "url": "https://client_domain.com/webhook",     
        "customHeader": {
          "header1": "value_1",
          "header2": "value_2"
        }
      },
      "createdTime": "2024-01-24T23:20:28Z",
      "lastModifiedTime": "2024-01-24T23:20:28Z"
    }
   ]
}

👍

More Information

  • For more information on the fields in the List Webhooks endpoint, see List Webhooks
  • See List Webhooks to view the endpoint in the API Explorer

Get Webhook Details

The Get Webhook Details endpoint enables you view the details of a webhook by using specifying the WebhookId in the URL. You can return the details of a webhook by making a GET request to the Get Webhook Details endpoint. For example

{{base-url}}/api/v1/Webhooks/{webhook_id}

If successful, a 200 response is returned with details of the webhook in the response.

{
"status": "success",
"response": {
"webhookId": "af2d48de-2ad7-42f8-a252-8422cd9e6078",
"productId": 123,
"events": [],
"webhookStatus": "active",
"config": {},
"createdTime": "2024-01-24T23:20:28Z",
"lastModifiedTime": "2024-02-04T20:12:25Z"
}
}

👍

More Information

Ping Webhook

The Ping Webhook endpoint enables you to verify the status or "heartbeat" of your registered webhook. By accessing this endpoint, you can ascertain whether the webhook URL is reachable and responsive, ensuring the dependability and efficiency of your integration with Thredd.

You can get the webhook status by making a GET request to the Ping Webhook endpoint. For example:

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

If successful, a 200 response is returned with details of the webhook in the response.

{
  "status": "success",
  "response": {
    "webhookId": 1234567890,
    "healthStatus": "healthy"
  }
}

👍

More Information