Alerts Endpoints
All HTTP methods should be prepended by this service's endpoint:
This service has the following endpoints available:
Description | Endpoints |
---|---|
Create a webhook | POST /webhooks |
Get a webhook | GET /webhooks/{id} |
Get all webhooks | GET /webhooks |
Get failed calls for webhooks | GET /webhooks/failed-calls |
Delete a webhook | DELETE /webhooks/{id} |
Note that currently it's not possible to update a Webhook with a single request. If you want to update an existing Webhook resource, you have to delete it first and then recreate it. In doing so, be aware that if the update changes the Webhook URL, it's recommended that you keep the previous URL up and running until you get the response from the recreation request (POST).
For easy testing of these endpoints, we recommend using our Postman collection.
To understand how to verify if an incoming request comes from Leaf, see the Authentication section.
Create a webhook
 POST /webhooks
Creates a webhook resource, specifying which events you want to be notified about and where (server URL). The webhook will begin receiving events immediately after it is created.
It's not possible to create different webhooks that listen to the same events. For example,
if you have already registered a webhook listening for newSatelliteImages
and try to register another one, you'll get a 400 response with error eventRegisteredTwice
.
Request body
Parameter | Type | Description |
---|---|---|
events | enum name of the event type | They are defined in the "Events" section of the services chapters (e.g. newSatelliteImage ) |
name | string | The name of your webhook |
secret | string | The secret used for HMAC authentication. We sign payload with this secret. See more here |
url | a valid HTTP URL string | The address of your webhook server |
Example in JSON:
Request example
- cURL
- Python
- JavaScript
Response
It returns a JSON containing information about the webhook created.
If you need to test your endpoint, here is a request example so you can simulate the validation Leaf will do.
- cURL
- Python
- JavaScript
Get a webhook
 GET /webhooks/{id}
Retrieve a specific webhook resource by its id.
Request example
- cURL
- Python
- JavaScript
Response
Get all webhooks
 GET /webhooks
Retrieve all Webhooks.
Request example
- cURL
- Python
- JavaScript
Response
It returns a list of JSON objects.
Get failed calls for webhooks
 GET /webhooks/failed-calls
Retrieve all failed calls for webhooks.
Request example
- cURL
- Python
- JavaScript
Response
It returns a list of JSON objects.
Delete a webhook
 DELETE /webhooks/{id}
Delete a specific Webhook resource by its id. Returns 204 status code if the delete succeeded.
Warning
If you delete a Webhook resource, we no longer will send you the events the webhook listens to.
Request example
- cURL
- Python
- JavaScript