This API is used to create webhooks.
| Property | Value |
|---|---|
| URL | {{APP_URL}}/api/v1/webhooks |
| HTTP Method | POST |
| Content Type | application/json |
| Authentication | APIKEY header |
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
description |
String (MAX 255) | REQUIRED | Webhook description |
endpoint |
String (MAX 255) | REQUIRED | Webhook URL |
subscribedEvent |
String (MAX 255) | REQUIRED | Subscribed event |
securityType |
String (MAX 255) | REQUIRED | Authentication type |
dataType |
String (MAX 255) | REQUIRED | Data type |
data |
String (MAX 255) | OPTIONAL | Data |
securityData |
Array | REQUIRED | Additional security data for authentication |
status |
Integer | REQUIRED | Status |
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
headerKey |
String (MAX 255) | REQUIRED | Header key |
headerValue |
String (MAX 255) | REQUIRED | Header value |
Below is an example JSON data for the API request.
POST {{APP_URL}}/api/v1/webhooks
Content-Type: application/json
Authorization: APIKEY {{APIKEY}}
{
"description": "My Tracking",
"endpoint": "https://myapi.com/status",
"subscribedEvent": "consignment.status.updated",
"securityType": "header",
"dataType": "JSON",
"data": "",
"securityData": [
{
"headerKey": "Authorization",
"headerValue": "123"
}
],
"status": 1
}
On a successful request, the API will return a response like the following:
{
"status": true,
"message": "Webhook created successfully",
"data": {
"webhook_id": "WEB123456789",
"description": "My Tracking",
"endpoint": "https://myapi.com/status",
"subscribedEvent": "consignment.status.updated",
"securityType": "header",
"dataType": "JSON",
"data": "",
"securityData": [
{
"headerKey": "Authorization",
"headerValue": "123"
}
],
"status": 1,
"created_at": "2023-10-01T12:34:56Z"
}
}
If the API request fails, the API will return an error response like the following:
{
"status": false,
"errors": [
{
"message": "Invalid endpoint URL. Please check the URL and try again."
}
]
}