Enabling webhooks and Fetch Updates for ArcGIS Enterprise 11.1 (Preview)

1522
12
09-18-2023 07:30 PM
AnthonyLatini
Esri Contributor
1 12 1,522

Configure layer in ArcGIS Enterprise to allow editing

 

To begin, you must enable the feature layer to allow editing. If the layer does not have these options enabled, the webhook and updates will not work.

  1. Log into your ArcGIS Enterprise portal
  2. Navigate to the location of your feature layer and select it

AnthonyLatini_0-1695090413822.png

 

  1. Select the layer that you want to enable editing on

AnthonyLatini_1-1695090413830.png

 

  1. Click Settings from the ribbon

AnthonyLatini_2-1695090413843.png

 

  1. Scroll down to the Feature layer (hosted) section and enable the following options under Editing:
    1. Enable editing
    2. Keep track of changes to the data
  2. Under the What kind of editing is allowed section, enable the options applicable to your flow
  3. The settings will save automatically

AnthonyLatini_3-1695090413873.png

 

Configure trigger (automated cloud flow) in Power Automate

Next, we need to configure the trigger in Power Automate to obtain the HTTP POST URL. In these steps, a flow will be configured to listen for changes to the feature layer.  

  1. Create a new automated flow
  2. Name your flow and then select Skip
    1. The following trigger is not in the auto-generated list when creating a flow
  3. In the Flow editor, search for the following trigger and select it:
    1. When an HTTP request is received

AnthonyLatini_4-1695090413923.png

 

  1. In the Request Body JSON Schema, paste the following JSON into the field:

 

{

    "type": "object",

    "properties": {

        "serviceType": {

            "type": "string"

        },

        "changesUrl": {

            "type": "string"

        },

        "name": {

            "type": "string"

        },

        "id": {

            "type": "string"

        },

        "folderName": {

            "type": "string"

        },

        "serviceName": {

            "type": "string"

        },

        "events": {

            "type": "array",

            "items": {

                "type": "object",

                "properties": {

                    "eventType": {

                        "type": "string"

                    },

                    "when": {

                        "type": "integer"

                    }

                },

                "required": [

                    "eventType",

                    "when"

                ]

            }

        }

    }

}

 

  1. Add a new action and search for the ArcGIS Enterprise connector
  2. Under the list of actions, select Fetch updates, changes, or deletions from feature layer (Preview)

AnthonyLatini_5-1695090413967.png

 

  1. In the Get changes from field, select the chnagesUrl from the dynamic content list

AnthonyLatini_6-1695090413996.png

 

  1. Select the layer that is needed for the webhook flow. This should be the same layer you edited in the first section of this walkthrough.

AnthonyLatini_7-1695090414012.png

 

  1. By default, all the options that can be used as trigger are set to true. You can change these options based on the type of flow you are creating.

AnthonyLatini_8-1695090414021.png

 

  1. Save the flow. After saving, the trigger will autogenerate a URL. This URL is needed for the next steps and configuring the webhook in ArcGIS Enterprise.

AnthonyLatini_9-1695090414042.png

 

  1. After saving, you should have a flow that looks like this:

AnthonyLatini_10-1695090414110.png

 

  1. Keep this tab open as the HTTP POST URL will be needed for configuration steps in the Enterprise organization

 

Configure feature layer with webhook URL

 

This section will go over the steps necessary to create a webhook on the feature layer you are using for your flow.

 

Prerequisite: You must be signed in as an administrator on the Enterprise organization to process the next steps.

 

  1. Navigate to the following URL:
    1. https://organization.domain.com/server/admin/login
  2. When the page loads, you should see the following screen:

AnthonyLatini_11-1695090414134.png

  1. In a new tab, open the following page:
  2. https://organization.domain.com/portal/sharing/rest/generateToken
  3. The following page appears:

AnthonyLatini_12-1695090414148.png

  1. Type in the administrator’s username and password
  2. Under the Client section, ensure that Wepapp URL is selected and type in the following URL format:
    1. https://organization.domain.com:443/server/admin
  3. Set the expiration to any of the options in the dropdown. The default is one hour.
  4. Once all the fields are filled in, press Generate Token
  5. Copy the Generated Token from the new field that appears

AnthonyLatini_13-1695090414150.png

 

  1. On the previous page/tab, paste in the newly generated token to the Portal token field
  2. Press Login

AnthonyLatini_14-1695090414151.png

  1. Once logged in, select Services from the list of resources

AnthonyLatini_15-1695090414157.png

 

  1. Select the appropriate folder where the feature layer is stored. By default, this should be under the Hosted category

AnthonyLatini_16-1695090414161.png

 

  1. Select the service you want to add the webhook to

AnthonyLatini_17-1695090414164.png

 

  1. When the new page loads, scroll to the bottom of the page
  2. Select webhooks

AnthonyLatini_18-1695090414167.png

 

  1. From the Supported Operations section, select create

AnthonyLatini_19-1695090414170.png

 

 

  1. On the Create Webhook page, fill in the appropriate information to create the webhook
    1. Name: Name the webhook. It is recommended to name this something meaningful to keep track of the webhooks
    2. Changes type: By default, a “*” (wildcard) should be entered to retrieve all the changes on the layer. You can specify which changes you’d like if you do not want to capture every action made against the layer.
      1.      AnthonyLatini_20-1695090414172.png

         

    3. HookURL: This is the URL that was generated from the Power Automate automated flow. Paste the value from the trigger into this field.

AnthonyLatini_21-1695090414180.png

 

AnthonyLatini_22-1695090414182.png

 

  1. After pasting the URL, click Create
  2. The webhook has been successfully created

AnthonyLatini_23-1695090414185.png

 

 

Create a flow to test the webhook on the feature layer

 

Now that the webhook has been created, we can run a simple test to see if the webhook is listening and capturing changes as expected. A simple test for this is to add a new attachment to a feature layer.

  1. Create a new Instant Cloud flow from your Power Automate landing page
  2. You can name the new action; however, it is not necessary. This action is meant as a test to see if the webhook is working and can be deleted after the test.

AnthonyLatini_24-1695090414223.png

 

  1. Add a new step and search for the ArcGIS Enterprise connector
  2. Select Add attachment from the list of actions

AnthonyLatini_25-1695090414249.png

 

  1. In the action window, select the layer that contains the webhook
  2. For Record ID, type in an ObjectID or unique identifier from your feature layer. You may need to show this column in your data table

AnthonyLatini_26-1695090414268.png

 

  1. For Attachment name, type in:
    1. webhooktest.txt

AnthonyLatini_27-1695090414270.png

 

  1. For File content, type in:
    1. This is a test.

AnthonyLatini_28-1695090414271.png

 

  1. Save and test the flow
  2. After the flow runs, the Run History should show that it succeeded

AnthonyLatini_29-1695090414273.png

 

  1. Open the Webhook flow to see if the webhook was trigger correctly
  2. The Run History should also show a new entry and the webhook process should be successful

AnthonyLatini_30-1695090414275.png

 

 

12 Comments