Configuring the HTTP Activity

As an administrator, you can configure the HTTP activity to access RESTful Web APIs in your workflow. This allows you to send requests using HTTP to web services in order to retrieve or update data. The HTTP activity encapsulates the header and body of the API request, making it easy to use within your workflow.

For example, if your workflow needs to retrieve data from a third-party application that supports a REST API, you can use the HTTP activity to request that data, and then the data can be accessed by the workflow.

To add a HTTP activity:

  1. Click the icon on the workflow at the position where you want to add the HTTP activity.
  2. From the activity wheel, select the icon and click the icon.

    The opens the HTTP activity configuration window.

  3. From the GET drop-down list, select the method that you want to perform. The drop-down list includes the following functions:
    • GET – this is used to request data from the configured web service. This is the most commonly used method for HTTP requests.
    • PUT - this is used to send data to a web service to create or update a resource. If the resource does not exist, the PUT request will create it; if it exists, the PUT request will update it, overwriting all properties in the resource with the properties provided in the PUT request. PUT requests are idempotent, which means that if the same request is sent multiple times, it will access the same resource and not create a new identical resource.
    • POST- this is used to send data to a server to create a resource. Note that as opposed to the PUT request, the POST request is non-idempotent, which means that if the resource in the POST request already exists, a duplicate copy of the resource will be created by the POST request.
    • PATCH – this is less commonly used in REST interfaces but is similar to PUT, as it is used to update a resource. With a PATCH request, only the properties being updated need to be specified, as opposed to PUT, which updates all properties.
      Note: Not all web services with a REST API support PATCH.
    • DELETE – this deletes the specified resource on the web service.
    • HEAD – this is similar to GET, where a request is sent to the web service to retrieve data, but without the response body, so that no actual data is returned. This request is useful to check the return value of GET before retrieving all of the actual data in cases where there is a large amount of response data.
      Note: Not all web services with a REST API support HEAD
  4. In the Enter request URL text box, enter the URL you want to access. This is the URL to the web service supporting the REST API, for example, https://router.api.mitel.io/2018-03-03/skillgroups/
  5. In the Headers tab, click the button to add any required headers. A new row is added that allows you to enter the header and the value. By default, the header Content-Type is included, with the value set to application/JSON. Consult the documentation for the REST API you are accessing for details on any other required header values.
    1. In the Enter Header text box, enter the header string.
    2. In the Enter Value text box, enter the value of application/file format value. Note: To delete the entered row, click the delete icon
  6. In the Body tab, enter the content to be sent in the HTTP request. For PUT, POST, and PATCH methods, the Body will normally contain the data to be updated on the web service. This field is disabled for GET and DELETE requests since no data is provided in the request; only the URL is sent to the web service. This field is required for PUT and POST requests.
    Note:

    The Body should be formatted based on the value defined in the Content-Type header.

    For example, if Content-Type = application/json, the Body could be formatted in JSON format as follows:

    {

    "action": "Pending",

    "subAction": "Set"

    }

  7. In the Authorization tab, you can select an existing connection for a third-party product already integrated with Voice Assist . This allows you to use the credentials configured for the selected connection to integrate with the REST API supported by that connection.
    Note: The Authorization configuration is optional and does not need to be configured for REST APIs not using third-party authentication, such as when using the Mitel CloudLink APIs.
    1. From the Integration drop down list, select the configured third-party software that supports the REST API to which you are connecting.
  8. Click Test to test the HTTP activity. It is recommended that you test the request before deploying it in your workflow.
  9. Click the Testing tab.
    1. Any runtime variables defined in the URL will be listed. Enter values for these variables if applicable.
    2. Click the Test button to execute the API request. The corresponding response is displayed in the Response field
  10. Click OK.
  11. Click Save to save the activity in the workflow.

The HTTP activity is added to the workflow.