Add and configure Send Web Request

License:

This functionality requires a license for the ArcGIS Workflow Manager Server Advanced role.

The Send Web Request step allows you to send requests to REST endpoints to get data or post updates. You can configure the REST endpoint's response as custom output values, save it as a file, and attach it to the job. The custom output values can be used to retrieve tokens for subsequent REST calls, direct the workflow path, or be used as inputs for other steps.

When the step is run, the web request is sent to the REST endpoint defined in the step.

The step can be finished by clicking Complete Step Complete Step.

Configure the step

Do the following to configure the step:

Caution:

To reduce security vulnerabilities, only configure the Send Web Request step for trusted web pages and web apps.

  1. Create or edit a workflow diagram to access the Step Library panel.
  2. Drag Send Web Request from the Step Library panel to a connection arrow of a step on the workflow canvas.

    The Step Details panel appears.

  3. Provide a name for the step in the Step Name text box.
  4. In the Arguments section, click Edit.
  5. Click the URL drop-down arrow and choose the type of request you want to send.
  6. Type the URL of the REST endpoint in the URL text box.
  7. Optionally, add path variables to the URL using the following syntax:
    https://gisserver.domain.com/webadaptorname/apps/workflowmanager/:pathVariable/

    Path variables appear in the Path Variables section.

  8. Optionally, add query parameters to the web request.
    1. Click Add Key & Value in the Query Parameters section.
    2. Provide a key in the Key text box.

      You can also use ArcGIS Arcade expressions to provide a dynamic value.

    3. Provide a value in the Value text box.

      You can also use ArcGIS Arcade expressions to provide a dynamic value.

    4. Leave the Enabled check box checked.
    5. Repeat substeps a through d to add more key-value pairs.
  9. If you added path variables to the URL, provide a value for each variable in the Path Variables section.

    You can also use ArcGIS Arcade expressions to provide a dynamic value.

    Tip:

    Click This input supports Arcade Expressions This input supports Arcade expressions and choose an ArcGIS Arcade expression to add it to its associated text box.

  10. Click the Authorization tab.
  11. Choose the REST endpoint's authentication method and provide authentication information as necessary.
    Caution:

    Authentication information you provide in the step is not encrypted. You can store information securely by adding an encrypted user-defined setting that can be referenced in the step using dynamic job properties.

    Note:

    The Federated Token option allows you to authenticate web requests as the user performing the step. The Federated Token option is only compatible with services published to the same Enterprise site as Workflow Manager.

    1. Optionally, if you chose the API Key or Bearer Token option, click Alternatively Generate Token from Endpoint.

      The Generate Token from Endpoint dialog box appears.

    2. Configure token settings to generate a token for the web request.
  12. Optionally, click the Headers tab to add custom header key-value pairs to the web request.
    1. Click Add Key & Value in the Custom Headers section.
    2. Provide a key in the Key text box.

      You can also use ArcGIS Arcade expressions to provide a dynamic value.

    3. Provide a value in the Value text box.

      You can also use ArcGIS Arcade expressions to provide a dynamic value.

    4. Leave the Enabled check box checked.
    5. Repeat substeps a through d to add more key-value pairs.
  13. Optionally, click the Body tab to add data to the web request.

    The request body supports form data key-value pairs, URL encoded key-value pairs, and raw data in JSON or plain text format.

    Tip:

    You can also use an ArcGIS Arcade expression to retrieve user-defined settings or provide dynamic values in the body text.

  14. Optionally, if you have a license for the ArcGIS Workflow Manager Server Advanced role, configure the step's output settings.
  15. Optionally, click the Test tab and click Test Response to send the configured request and show its response.

    If the web request contains job-specific Arcade expressions, you must turn on Include Job ID and provide a job ID in the Job ID text box to properly format the request.

  16. Click Save to close the Configure Web Request dialog box.
  17. Click the Options tab.
  18. Configure Step Options as necessary.
    • Manual—Run the step manually.
      • Optional—Allow the step to be finished without being run.
    • Automatic—Run the step as soon as it becomes active.
      Note:

      If your workflow diagram is configured to automatically run a sequence of steps that includes the Evaluate Data Quality or the Run GP Service step, steps that attempt to run after the user token that started the sequence of steps expires will not run automatically. You must have a license for the ArcGIS Workflow Manager Server Advanced role to continue running more automated steps without manual intervention.

    • Run on a Schedule—Run the step according to a schedule you set.

      Learn more about scheduling options

  19. Optionally, choose one of the following options to configure help in the step:
    • None—Configure the step without step help.
    • Text—Configure help text for the step in the Text text box.

      You can use ArcGIS Arcade expressions to provide a dynamic value for the step help. If the step help contains plain text and Arcade expressions, you must format the text as follows:

      
      'For further assistance, please contact' + JobCreator($Job) + '.'

    • URL—Configure the step with a link to a help resource in the URL text box.
      Note:

      Steps run in the web app only support HTTP and HTTPS URL formats. Steps run in ArcGIS Pro support HTTP, HTTPS, and file formats.

      You can also use Arcade expressions to provide a dynamic value. If the URL contains plain text and Arcade expressions, you must format the text as follows:

      
      'https://pro.arcgis.com/en/pro-app/latest/tool-reference/' + JobExtendedProperty($Job, 'tools', 'toolbox') + '/' + jobExtendedProperty($job, 'tools', 'alias') + '.htm'

      Configure the Automatically Encode Arcade Result check box:

      • If an Arcade expression returns special characters that must be escaped when converted to a URL, such as a space or a forward slash, ensure that the Automatically Encode Arcade Result check box is checked.
      • If an Arcade expression is used to form the base URL, uncheck the Automatically Encode Arcade Result check box.

  20. Optionally, click the Style tab to change the shape and color of the step.
  21. Optionally, click the About tab and provide a description for the step in the Step Description text box.
    Tip:

    The About tab also contains the step's ID that can be used with dynamic job properties to obtain a step's output. Click Copy Step ID Copy Step ID to copy the step ID to your clipboard.

Configure token settings

If the REST endpoint that you are sending a web request to requires a token for authentication, complete these steps to configure the Send Web Request step to generate a token for authentication:

  1. Click the URL drop-down arrow and choose the type of request you want to send.
  2. Type the URL of the REST endpoint in the URL text box.
  3. Optionally, add path variables to the URL using the following syntax:
    https://gisserver.domain.com/webadaptorname/apps/workflowmanager/:pathVariable/

    Path variables appear in the Path Variables section.

  4. Optionally, add query parameters to the web request.
    1. Click Add Key & Value in the Query Parameters section.
    2. Provide a key in the Key text box.

      You can also use ArcGIS Arcade expressions to provide a dynamic value.

    3. Provide a value in the Value text box.

      You can also use ArcGIS Arcade expressions to provide a dynamic value.

    4. Leave the Enabled check box checked.
    5. Repeat substeps a through d to add more key-value pairs.
  5. If you added path variables to the URL, provide a value for each variable in the Path Variables section.

    You can also use ArcGIS Arcade expressions to provide a dynamic value.

    Tip:

    Click This input supports Arcade Expressions This input supports Arcade expressions and choose an ArcGIS Arcade expression to add it to its associated text box.

  6. Optionally, click the Headers tab to add custom header key-value pairs to the web request.
    1. Click Add Key & Value in the Custom Headers section.
    2. Provide a key in the Key text box.

      You can also use ArcGIS Arcade expressions to provide a dynamic value.

    3. Provide a value in the Value text box.

      You can also use ArcGIS Arcade expressions to provide a dynamic value.

    4. Leave the Enabled check box checked.
    5. Repeat substeps a through d to add more key-value pairs.
  7. Optionally, click the Body tab to add data to the web request.

    The request body supports form data key-value pairs, URL encoded key-value pairs, and raw data in JSON or plain text format.

    Tip:

    You can also use an ArcGIS Arcade expression to retrieve user-defined settings or provide dynamic values in the body text.

  8. Click the Token tab.
  9. Click the Test Mode toggle button in the Token section.
  10. Paste an example of the REST endpoint's response in the Sample Response text box.

    Example response in JSON format:

    {"access_token": "12345abcde",
    "expires_in":7199,
    "spatialReference": {
      "wkid": 4326,
      "latestWkid": 4326
    },
    "location": [
      {
        "name": "380 New York Street",
        "extent": {
          "xmin": -117.196701,
          "ymin": 34.055489
        }
      }
    ]}
  11. Provide a name for the token in the Output Value text box.

    This is the name that is used by the step to reference the generated token.

  12. Provide a JSONPath expression in dot notation or bracket notation in the Extraction Path text box to parse the response and return the generated token.

    Example JSONPath in dot notation:

    $.access_token

    Example JSONPath in bracket notation:

    $['access_token']

    The value appears in the Sample Result column.

  13. Click Back to Step Configuration to continue configuring the step.

Configure output settings

License:

This functionality requires a license for the ArcGIS Workflow Manager Server Advanced role.

You can save the REST endpoint's response as a file, attach it to the job, and configure it as custom output values. The output values can be used to direct workflow paths or be used as inputs for other steps. If an output value is not configured for the step, the HTTP status code is stored as the step's output value. Do the following to configure the step's output settings:

  1. Click the Output tab on the Configure Web Request dialog box.

    If the Configure Web Request dialog box isn't available, click the Send Web Request step on the workflow canvas and click Edit in the Arguments section of the Step Details panel.

  2. Optionally, click the Enabled toggle button in the Attach Response section to save the REST endpoint's response as a file and attach it to the job.
  3. Optionally, configure the attachment name and folder where the response will be stored:
    1. Provide the name of the folder where the attachment will be stored in the Folder Name text box.

      The folder name can't contain a file system path or special characters. If a folder name isn't provided, a folder named General is automatically created.

      Note:

      The folder is contained within the workflow item and is not a file system path.

    2. Choose one of the following Attachment Name options:
      • Autogenerated—Automatically names the attachment using the following syntax: <StepName>_<RunDate>_<RunTime>
      • Custom—Allows a custom attachment name to be provided
  4. Optionally, configure custom output values for the REST endpoint's response:
    1. Click the Test Mode toggle button in the Output Values section.
    2. Paste an example of the REST endpoint's response in the Sample Response text box.

      Example response in JSON format:

      {"access_token": "",
      "expires_in":7199,
      "spatialReference": {
        "wkid": 4326,
        "latestWkid": 4326
      },
      "location": [
        {
          "name": "380 New York Street",
          "extent": {
            "xmin": -117.196701,
            "ymin": 34.055489
          }
        }
      ]}
    3. Click Add Output & Path.
    4. Provide a name for the output value in the Output Value text box.

      This is the value name that is used to obtain the custom output value.

    5. Provide a JSONPath expression in dot notation or bracket notation for the value that you want to store in the Extraction Path text box.

      Example JSONPath in dot notation:

      $.location.0.name

      Example JSONPath in bracket notation:

      $['location'][0]['name']

      The value appears in the Sample Result column.

    6. Optionally, repeat substeps c through e to add more custom output values.
  5. Click Save to close the Configure Web Request dialog box.

Return value

When the step is completed, its return value is stored to indicate the result of the step. The return value can be immediately evaluated using paths to determine the next steps in the workflow. You can also retrieve the return value for completed steps throughout the workflow using ArcGIS Arcade expressions. The following table lists the step's return values:

Return valueDescription

S000001

The step completed successfully.

F000001

The step failed to complete successfully.

Output value

License:

This functionality requires a license for the ArcGIS Workflow Manager Server Advanced role.

When the step is completed, its output value is stored and can be used to determine the path the workflow follows or can be used as inputs for other steps throughout the workflow. The following table lists the step's output value:

OutputDescription

Status

Returns the HTTP response code if an output value isn't configured for the step.

<CustomOutputValue>

Returns the custom output value you configured for the step.

attachmentId

Returns an array of attachment IDs added to the step.

Related topics