Create (Feature Service)
- URL:https://<WebHooks-url>/create(POST only)
- 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 signatureKey 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.
Note:
The same callback URL with overlapping events is not supported.
Request parameters
Parameter | Details |
---|---|
name (Required) | The name of the webhook. Syntax: String |
changeTypes ("Events") | Specifies the events that will trigger the webhook. The default is ["*"] if no value is specified. For more information about the following values, see the Trigger event values section below. Syntax: Array Values: * | FeaturesCreated | FeaturesUpdated | FeaturesDeleted | FeaturesEdited | AttachmentsCreated | AttachmentsUpdated | AttachmentsDeleted | LayerSchemaChanged | LayerDefinitionChanged | FeatureServiceDefinitionChanged |
signatureKey (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 x-esriHook-Signature header. Syntax: String Example
|
hookUrl (Required) | The payload URL. Syntax: String Example
|
active (Optional) | Enables or disables call backs when the webhook is triggered. The default value is false. Values: true | false |
contentType | The media type of the resource. The media type is a string sent along with the file indicating the format of the file. Note:Microsoft Power Automate supports application/json. Values: application/json | application/x-www-form-urlencoded |
scheduleInfo (Optional) | Sets the schedule properties of a webhook. Note:The interval value minimum is 30 seconds.Syntax
Example
|
payloadFormat | The response payload format. The default format is json. Values: json | pjson |
f | The response format. The default format is html. Values: html | json | pjson |
Trigger event values
The accepted values and their descriptions for the changeTypes parameter are listed below.
Values | Description |
---|---|
* | A wildcard event. Any event will trigger the webhook. |
FeaturesCreated | A new feature is created. |
FeaturesUpdated | A feature is updated. |
FeaturesDeleted | A feature is deleted. |
FeaturesEdited | A feature is edited (insert, update, or delete) |
AttachmentsCreated | A new attachment is added to a feature. |
AttachmentsUpdated | A feature attachment is updated. |
AttachmentsDeleted | A feature attachment is deleted. |
LayerSchemaChanged | A schema is changed in a layer. |
LayerDefinitionChanged | A layer definition is changed. |
FeatureServiceDefinitionChanged | A feature service is changed. |
Example usage
The following is a sample request URL for the create operation:
https://myserver.domain.com/myTenant/ArcGIS/rest/admin/services/states/FeatureServer/WebHooks/create
Example 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://myserver.domain.com/myTenant/ArcGIS/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://myserver.domain.com/myTenant/ArcGIS/rest/services/WebHooks/FeatureServer",
"signatureKey": "",
"format": "json",
"serverGen": 8108706,
"createdTime": 1589773034742,
"lastUpdatedTime": 1589773034742,
"changeTypes": [
"All"
],
"scheduleInfo": {
"name": "",
"state": "enabled",
"recurrenceInfo": {
"frequency": "second",
"interval": 30
}
}
}
]