v1 Webhooks (deprecated)
Celantur Cloud API uses webhooks to notify your application when a file has been processed.
Last updated
Celantur Cloud API uses webhooks to notify your application when a file has been processed.
Last updated
By setting a webhook
URL in the request to , a HTTPS POST request will be sent to the specified URL, as soon as the submitted file has finished processing.
url = 'https://api.celantur.com/v1/file?method=blur&face=True&webhook='
response = requests.post(
url,
data=image,
headers={'Authorization': auth_token}
)
The payload sent to the webhook URL looks like this:
{
customer_id={customer_id}
file_id={file_id}
file_status="done"
original_link="https://api.celantur.com/v1/file/{file_id}/original"
anonymized_link="https://api.celantur.com/v1/file/{file_id}/anonymized"
binary_mask_link="https://api.celantur.com/v1/file/{file_id}/binary-mask"
instance_mask_link="https://api.celantur.com/v1/file/{file_id}/instance-mask"
metadata_link="https://api.celantur.com/v1/file/{file_id}/metadata"
}
import requests
...
webhook_url = 'https://example.com/webhook/dev?sender=celantur&approve=always'
# encode the URL you want to send the webhook to
# returns 'https://example.com/webhook/dev?sender=celantur%26approve=always'
webhook_url_encoded = webhook_url.encode()
# set webhook in the POST request
response = requests.post('https://api.celantur.com/v1/file?method=blur&face=True&webhook=' + webhook_url_encoded,
data=image,
headers={'Authorization': auth_token}
)
Webhooks are especially useful to trigger the download of a file, right after it has finished processing. See
Set the webhook
URL in the request's URL parameter.
The webhook URL needs to be encoded correctly, in order to not interfere with the endpoint URL: