ArcGIS REST API

Create Webhook

Description

The createWebhook operation allows portal administrators to create a new webhook. Administrators will specify the trigger events for this webhook, and the URL to which payloads are delivered when the webhook is invoked. For additional security, the secret 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 a connection to the portal is successful.

Note:

This operation was introduced in ArcGIS Enterprise 10.7.

Request parameters

ParameterDetails
name

(required)

Specifies the webhook's name.

Syntax: String

url

(required)

Identifies the payload URL.

Syntax: String

"https://webhookURL:8000"

secret

(optional)

A user-defined element that can be added to the payload to help authenticate the message on your receiver.

Syntax: String

"12345ABCDE"

configuration

(optional)

Sets the configuration properties for your webhook.

Syntax: JSON object

{
   "deactivationPolicy": {
      "numberOfFailures": 5,
      "daysInPast": 5
   }
}

events

(required)

Defines the events that will trigger the webhook.

Syntax: JSON array (string)

["/items","/users"]

Example usage

Example of sharing API request

https://webadaptor.domain.com/webadaptorname/sharing/rest/portals/<org ID>/createWebhook

Trigger Events

A webhook can be configured to subscribe to one or more trigger events. For more information, see our Portal Administrator documentation for a list of available trigger events.

Subscribe to all events

You can subscribe to all trigger events in Portal by using the forward slash "/". Below is a sample JSON response value where all events have been subscribed to.

...
  "events": [
      "/"
  ]}}

Subscribe to all events for a specific item type

You can subscribe to specific events for a specific item type (items, users, or groups). Subscribing to events associated to a specific item type will trigger the webhook any time one of these item types are added, modified, or deleted. Below is a sample JSON response value where all events pertaining to all items have been subscribed to.

...
   "events": [
      "/items"
   ]}}

Subscribe to all events pertaining to a specific user

You can subscribe to events associated with a specific user. Below is a sample JSON response value where only events associated to a specific user will trigger the webhook.

...
   "events": [
      "/users/<username>"
   ]}}

Subscribe to all events pertaining to a specific group

You can subscribe to events associated with a specific group. Below is a sample JSON response value where only an update to a specific group will trigger the webhook.

...
   "events": [
      "/groups/<groupId>/update"
   ]}}

Subscribe to more than one trigger events

You can subscribe to a combination of trigger events by separating the URIs with commas within the parameter. Below is a sample JSON response value where more than one trigger event has been subscribed to.

...
   "events": [
      "/items",
      "/groups/<groupId1>",
      "/groups/<groupId2>"
   ]}}

JSON response example

{
  "success": true,
  "webhook": {
    "id": "2f2d59bd74b4496fa488f2118b7f0a47",
    "accountId": "0123456789ABCDEF",
    "payloadUrl": "https://machineName:8001",
    "secret": "",
    "isActive": true,
    "name": "Items and Users",
    "config": {
      "deactivationPolicy": {
        "numberOfFailures": 5,
        "daysInPast": 5
      }
    },
    "ownerId": "86ccfe86be2d490a8507eaea82749dc6",
    "created": 1548289054918,
    "modified": 1548289054918,
    "events": [
      "/items",
      "/users"
    ]
  }
}