Webhooks API Code Samples
Selection of code samples that demonstrate the use of the Webhooks API. Copy and edit these code samples to suit your needs.
When using the code samples, remember to replace:
- {vanity_name} with your tenant name
- {api_key} with your API key
- {security_token} with a valid security token
These code samples may not include all available parameters and request body fields for each endpoint. For the endpoint's full request schema, see "Webhooks" in API Reference.
Retrieve a list of webhooks
Use this sample request to retrieve all the webhooks for your tenant.
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1beta/op/webhooks' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'
Use this sample request to retrieve all the active webhooks for your tenant.
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1beta/op/webhooks?isActive=true' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'
The response returns each webhook's definition, such as its endpoint URL, active status, and event types.

{
"webhooks": [
{
"webhookId": "31271269-dd8c-46b6-b7a0-8f0855746b03",
"details": {
"targetUrl": "",
"isActive": false,
"events": [],
"displayName": "webhook_design"
},
"credentialReference": ""
},
{
"webhookId": "779c5dc4-c151-42eb-82cc-909e09039512",
"details": {
"targetUrl": "https://www.example.com/endpoint",
"isActive": true,
"events": [],
"keyName": "testKey",
"displayName": "webhook_name"
},
"credentialReference": "a63afc53-e2da-4dcd-8846-b752cf52ceb0"
},
...
]
}
Retrieve a webhook's details
Use this sample request to retrieve a specific webhook's details.
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1beta/op/webhooks/31271269-dd8c-46b6-b7a0-8f0855746b03' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'
The response returns the webhook's definition, such as its endpoint URL, active status, and event types.

{
"webhookId": "31271269-dd8c-46b6-b7a0-8f0855746b03",
"details": {
"targetUrl": "",
"isActive": false,
"events": [],
"displayName": "webhook_design"
},
"credentialReference": ""
}
Create a webhook
Use this sample request to create a new webhook with basic authentication.
curl -X POST --url 'https://{vanity-name}.api.visier.io/v1beta/op/webhooks' \
-H 'Cookie: VisierASIDToken={security_token}' \
-H 'apikey: {api_key}' \
-H 'Content-Type: application/json' \
-d '{
"details": {
"targetUrl": "https://www.example.com/endpoint",
"isActive": false,
"keyName": "sampleKey",
"events": [
{"eventType": "jobResultSuccess"},
{"eventType": "jobResultFailure"}
],
"displayName": "webhook_name"
},
"credentials": {
"basicAuth": {
"username": "exampleUser",
"password": "examplePassword"
}
}
}'
Use this sample request to create a new webhook with an access token and no credentials.
curl -X POST --url 'https://{vanity-name}.api.visier.io/v1beta/op/webhooks' \
-H 'Cookie: VisierASIDToken={security_token}' \
-H 'apikey: {api_key}' \
-H 'Content-Type: application/json' \
-d '{
"details": {
"targetUrl": "https://www.example.com/endpoint",
"isActive": false,
"keyName": "sampleKey",
"events": [
{"eventType": "jobResultSuccess"},
{"eventType": "jobResultFailure"}
],
"displayName": "webhook_name"
}
}'
The response returns the created webhook's definition, such as its endpoint URL, active status, and event types.

{
"webhookId": "31271269-dd8c-46b6-b7a0-8f0855746b03",
"details": {
"targetUrl": "https://www.example.com/endpoint",
"isActive": false,
"events": [
{"eventType": "jobResultSuccess"},
{"eventType": "jobResultFailure"}
],
"keyName": "sampleKey",
"displayName": "webhook_name"
},
"credentialReference": "2e4e6a6d-1500-4697-8a45-7285e3887d13"
}
Update a webhook's details
Use this sample request to replace the definition of an existing webhook.
curl -X PUT --url 'https://{vanity-name}.api.visier.io/v1beta/op/webhooks/31271269-dd8c-46b6-b7a0-8f0855746b03' \
-H 'Cookie: VisierASIDToken={security_token}' \
-H 'apikey: {api_key}' \
-H 'Content-Type: application/json' \
-d '{
"webhookId": "31271269-dd8c-46b6-b7a0-8f0855746b03",
"details": {
"targetUrl": "https://www.example.com/endpoint",
"isActive": true,
"keyName": "sampleKey",
"events": [
{"eventType": "jobResultSuccess"},
{"eventType": "jobResultFailure"}
],
"displayName": "webhook_design"
}
}'
The response returns the details of the updated webhook.

{
"webhookId": "31271269-dd8c-46b6-b7a0-8f0855746b03",
"details": {
"targetUrl": "https://www.example.com/endpoint",
"isActive": false,
"events": [
{"eventType": "jobResultSuccess"},
{"eventType": "jobResultFailure"}
],
"keyName": "sampleKey"
"displayName": "webhook_design"
},
"credentialReference": "2e4e6a6d-1500-4697-8a45-7285e3887d13"
}
Update a webhook's credentials
Use this sample request to change an existing webhook's credential definition for basic authentication.
curl -X PUT --url 'https://{vanity-name}.api.visier.io/v1beta/op/webhooks/31271269-dd8c-46b6-b7a0-8f0855746b03/credentials' \
-H 'Cookie: VisierASIDToken={security_token}' \
-H 'apikey: {api_key}' \
-H 'Content-Type: application/json' \
-d '{
"basicAuth": {
"username": "newUsername",
"password": "newPassword"
}
}'
Use this sample request to change an existing webhook's credential definition for access token.
curl -X PUT --url 'https://{vanity-name}.api.visier.io/v1beta/op/webhooks/31271269-dd8c-46b6-b7a0-8f0855746b03/credentials' \
-H 'Cookie: VisierASIDToken={security_token}' \
-H 'apikey: {api_key}' \
-H 'Content-Type: application/json' \
-d '{
"accessToken": "newToken"
}'
The response returns the details of the updated webhook.

{
"webhookId": "31271269-dd8c-46b6-b7a0-8f0855746b03",
"details": {
"targetUrl": "https://www.example.com/endpoint",
"isActive": false,
"events": [
{"eventType": "jobResultSuccess"},
{"eventType": "jobResultFailure"}
],
"keyName": "sampleKey"
"displayName": "webhook_design"
},
"credentialReference": "bfd1d0b1-a72f-4eb0-92d0-6765d19ea32f"
}
Delete a webhook
Use this sample request to delete a webhook.
curl -X DELETE --url 'https://{vanity_name}.api.visier.io/v1beta/op/webhooks/31271269-dd8c-46b6-b7a0-8f0855746b03' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'
The response returns the deleted webhook's definition, such as its endpoint URL, active status, and event types.

{
"webhookId": "31271269-dd8c-46b6-b7a0-8f0855746b03",
"details": {
"targetUrl": "",
"isActive": false,
"events": [],
"displayName": "webhook_design"
},
"credentialReference": ""
}
Delete a webhook's credentials
Use this sample request to delete a webhook's credentials.
curl -X DELETE --url 'https://{vanity_name}.api.visier.io/v1beta/op/webhooks/31271269-dd8c-46b6-b7a0-8f0855746b03/credentials' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'
The response returns the webhook's definition, such as its endpoint URL, active status, and event types.

{
"webhookId": "31271269-dd8c-46b6-b7a0-8f0855746b03",
"details": {
"targetUrl": "",
"isActive": false,
"events": [],
"displayName": "webhook_design"
},
"credentialReference": ""
}
Test a webhook
Use this sample request to send a test event to the webhook to validate that the webhook works.
curl -X POST --url 'https://{vanity_name}.api.visier/v1beta/op/webhooks/31271269-dd8c-46b6-b7a0-8f0855746b03/testEvent' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'Content-Type: application/json' \
-d '{
"eventType": "jobResultSuccess"
}'
The response returns whether the webhook notification attempt was successful or not.

{
"statusCode": 200,
"message": "Successfully delivered message. RequestResponse=Sample response from target",
"messageId": "73382f00-2b0a-4433-82e0-3f706947dadb",
"eventId": "726"
}