Skip to content

Create (Feature Service)

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 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.

Request parameters

ParameterDetails
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

Use dark colors for code blocksCopy
1
x-esriHook-Signature="sha256=x0mYd8goestNaiaMleQQseoJJelseim9BRse2lgisekvis"
hookUrl (Required)

The payload URL.

Syntax: String

Example

Use dark colors for code blocksCopy
1
"https://webhookURL"
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.

Values: application/json | application/x-www-form-urlencoded

scheduleInfo (Optional)

Sets the schedule properties of a webhook.

Syntax

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
{
  "name":"<webhook name>",
  "startAt":"<integer, Unix epoch time>",
  "state":"<enabled | disabled>",
  "recurrenceInfo": {
    "frequency":"<"second","minute","hour","day","week","month","year">
    "interval":<integer>
  }
}

Example

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
{
  "name":"Every-30seconds",
  "startAt":"1478280677536", //Integer
  "state":"enabled",
  "recurrenceInfo": {
    "frequency":"second",
    "interval":30
  }
}
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.

ValuesDescription
*A wildcard event. Any event will trigger the webhook.
FeaturesCreatedA new feature is created.
FeaturesUpdatedA feature is updated.
FeaturesDeletedA feature is deleted.
FeaturesEditedA feature is edited (insert, update, or delete)
AttachmentsCreatedA new attachment is added to a feature.
AttachmentsUpdatedA feature attachment is updated.
AttachmentsDeletedA feature attachment is deleted.
LayerSchemaChangedA schema is changed in a layer.
LayerDefinitionChangedA layer definition is changed.
FeatureServiceDefinitionChangedA feature service is changed.

Example usage

The following is a sample request URL for the create operation:

Use dark colors for code blocksCopy
1
https://gisserver.example.com/<context>/rest/admin/services/states/FeatureServer/WebHooks/create

Example 1: Create a webhook that posts payloads in JSON format:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
{
  "name": "WebHooks",
  "active": true,
  "changeTypes": [
    "FeaturesCreated",
    "LayerSchemaChanged"
  ],
  "hookUrl": "https://example.com/webhook"
}

JSON Response examples

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
{
  "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"
}
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
[
  {
    "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
      }
    }
  }
]

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.