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 |
The allowed keys to be filled in events are:
credentialsLimitedPermission
,credentialsUnauthenticated
,fieldCreated
,fieldBoundaryCreated
,fieldBoundaryUpdated
,uploadedFileProcessingFinished
,uploadedFileProcessingFailed
,providerFileProcessingFinished
,providerFileProcessingFailed
,mergedFileProcessingFinished
,mergedFileProcessingFailed
,automergedFileProcessingFinished
,automergedFileProcessingFailed
,operationCreated
,operationUpdated
,operationProcessingFinished
,newSatelliteImage
,machineCreated
,machineUpdated
,machineDeleted
To see the detailed description of each of these events, click here.
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.
info
In case of alert delivery failures, Leaf Alerts will make new attempts at 1, 30, 60 and 240 minutes.
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
Other channels
ArcGIS
info
This option is a beta feature
The alerts can be delivered in other channels like the arcgis
that enables the alert to be sent direct to an ArcGIS Geoprocessing service.
Create an ArcGIS alert
 POST /arcgis
Creates a alert for be consumed in an ArcGIS geoprocessing service specifying which events you want to be notified about and where (server URL). The alert will begin receiving events immediately after it is created.
It's not possible to create different alerts that listen to the same events. For example,
if you have already registered a alerts 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 alert |
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 geoprocessing service, make sure to use this format: https://{ArcGIS Server url}/server/rest/services/{service name}/GPServer/{toolname}/submitJob?f=json |
The allowed keys to be filled in events are:
credentialsLimitedPermission
,credentialsUnauthenticated
,fieldCreated
,fieldBoundaryCreated
,fieldBoundaryUpdated
,uploadedFileProcessingFinished
,uploadedFileProcessingFailed
,providerFileProcessingFinished
,providerFileProcessingFailed
,mergedFileProcessingFinished
,mergedFileProcessingFailed
,automergedFileProcessingFinished
,automergedFileProcessingFailed
,operationCreated
,operationUpdated
,operationProcessingFinished
,newSatelliteImage
,machineCreated
,machineUpdated
,machineDeleted
To see the detailed description of each of these events, click here.
Example in JSON:
Request example
- cURL
- Python
- JavaScript
Response
It returns a JSON containing information about the webhook created.
Geoprocessing configuration
This option requires that the geoprocessing is publicly available, that is, without authentication.
To prevent anyone from using your service inappropriately, consider implementing the secret validation mentioned here.