Webhooks API

Summary

Resource Operation Description
Webhooks GET /webhooks Gets all registered Webhooks
  POST /webhooks Creates a Webhook
  PATCH /webhooks/(id) Updates a Webhook
  PUT /webhooks/(id)  
  DELETE /webhooks/(id) Deletes a Webhook

Details

GET /webhooks
Status Codes:

Example response

{
  "status": "success",
  "data": {
    "webhooks": [{
      "id": "the-webhook-identifier",
      "url": "https://example.com/webhook",
      "enabled": true,
      "dc_ids": ["1", "2", "3"],
      "events": ["ROUTE_CREATED", "ROUTE_STARTED", "ROUTE_ETAS_CHANGED", "WAYPOINT_STATUS_CHANGED"]
    }, ...]
  }
}
POST /webhooks
Parameters:
  • webhook_url (string) – The Webhook URL to register
  • events (list) – The event types that should be sent
  • dc_ids (list) – The DCs for which events should be sent
Status Codes:

Example response

{
  "status": "success",
  "data": {
    "webhook": {
      "id": "the-webhook-identifier",
      "url": "https://example.com/webhook",
      "enabled": true,
      "dc_ids": ["1", "2", "3"],
      "events": ["ROUTE_CREATED", "ROUTE_STARTED"]
    }
  }
}

Note that Webhook URLs must be fully formed URLs using the http or https schema, e.g. https://example.com/my-webhook.

You can register for multiple event-types with one Webhook URL. See WebhookEventType for a complete description of all the available webhook events you can register for.

PATCH /webhooks/(id)
Parameters:
  • id (string) – The webhook id
  • enabled (bool) – Whether this webhook should be disabled or disabled
Status Codes:

Example response

{
  "status": "success",
  "data": {
    "webhook": {
      "id": "the-webhook-identifier",
      "url": "https://example.com/webhook",
      "enabled": true,
      "dc_ids": ["1", "2", "3"],
      "events": ["ROUTE_CREATED", "ROUTE_STARTED"]
    }
  }
}

Note that currently, only the enabled/disabled status of the Webhook can be modified. If you need to modify other properties of the Webhook, you will need to delete the existing Webhook and add another.

PUT /webhooks/(id)
Parameters:
  • id (string) – The webhook id
  • enabled (bool) – Whether this webhook should be disabled or disabled
Status Codes:

Example response

{
  "status": "success",
  "data": {
    "webhook": {
      "id": "the-webhook-identifier",
      "url": "https://example.com/webhook",
      "enabled": true,
      "dc_ids": ["1", "2", "3"],
      "events": ["ROUTE_CREATED", "ROUTE_STARTED"]
    }
  }
}

Note that currently, only the enabled/disabled status of the Webhook can be modified. If you need to modify other properties of the Webhook, you will need to delete the existing Webhook and add another.

DELETE /webhooks/(id)
Parameters:
  • id (string) – The Webhook id
Status Codes:
  • 200 OK – The Webhook was deleted.
  • 404 Not Found – The Webhook with this ID could not be found.