- URL:
- https://<WebHooks-url>/create
- Methods:
POST- Version Introduced:
- June, 2020
Description
The create operation allows administrators to create a webhook. Administrators specify the trigger events for the new webhook and the URL to which payloads are delivered when the webhook is invoked. For additional security, the signature parameter can be used to send a specific string that can be verified by the application listening on the payload URL. During the operation, the payload URL will be queried to confirm that a connection to the webhook is successful. A feature service can have multiple web hooks. Multiple webhooks can share the same callback URL.
Request parameters
| Parameter | Details |
|---|---|
name (Required) | The name of the webhook. Syntax: String |
change | Specifies the events that will trigger the webhook. The default is Syntax: Array Values: |
signature (Optional) | The secret key that will be used to generate the HMAC hex digest of value using the sha256 hash function and is returned in the Syntax: String Example |
hook (Required) | The payload URL. Syntax: String Example |
active (Optional) | Enables or disables call backs when the webhook is triggered. The default value is Values: |
content | The media type of the resource. The media type is a string sent along with the file indicating the format of the file. Values: |
schedule (Optional) | Sets the schedule properties of a webhook. Syntax Example |
payload | The response payload format. The default format is Values: |
f | The response format. The default format is Values: |
Trigger event values
The accepted values and their descriptions for the change parameter are listed below.
| Values | Description |
|---|---|
* | A wildcard event. Any event will trigger the webhook. |
Features | A new feature is created. |
Features | A feature is updated. |
Features | A feature is deleted. |
Features | A feature is edited (insert, update, or delete) |
Attachments | A new attachment is added to a feature. |
Attachments | A feature attachment is updated. |
Attachments | A feature attachment is deleted. |
Layer | A schema is changed in a layer. |
Layer | A layer definition is changed. |
Feature | A feature service is changed. |
Example usage
The following is a sample request URL for the create operation:
https://gisserver.example.com/<context>/rest/admin/services/states/FeatureServer/WebHooks/createExample 1: Create a webhook that posts payloads in JSON format:
{
"name": "WebHooks",
"active": true,
"changeTypes": [
"FeaturesCreated",
"LayerSchemaChanged"
],
"hookUrl": "https://example.com/webhook"
}JSON Response examples
{
"id": 1,
"url": "https://gisserver.example.com/<context>/rest/admin/services/states/FeatureServer/WebHooks/1",
"name": "WebHooks",
"changeTypes": [
"FeaturesCreated",
"LayerSchemaChanged"
],
"active": true,
"hookUrl": "https://callBackServerUrl/webhook",
"createdTime": "1526405454399",
"lastUpdatedTime": "1526405454399"
}[
{
"name": "WebHooks",
"owner": "webhook",
"id": 9,
"globalId": "c740ae24-92a1-4fd2-9a3b-8sdf4332239",
"tenantId": 01,
"serviceId": 5602321,
"active": true,
"hookUrl": "https://webhookURL",
"serviceUrl": "https://gisserver.example.com/<context>/rest/services/WebHooks/FeatureServer",
"signatureKey": "",
"format": "json",
"serverGen": 8108706,
"createdTime": 1589773034742,
"lastUpdatedTime": 1589773034742,
"changeTypes": [
"All"
],
"scheduleInfo": {
"name": "",
"state": "enabled",
"recurrenceInfo": {
"frequency": "second",
"interval": 30
}
}
}
]