Workflow Application: RESTAPICLIENT usage

The RESTAPICLIENT workflow application allows you to call REST API endpoints to exchange information with other applications through HTTP requests, and can be used to build integrations with extendable applications (such as Azure Services and Slack).

It also allows you to call a REST API endpoint using application/json or application/x-www-form-urlencoded payloads. RESTAPICLIENT will then receive and process the response from the external API by mapping the response content with defined OUT parameters.

See the RESTAPICLIENT Workflow Application section in the WorkflowGen Administration Guide for complete instructions on how to use RESTAPICLIENT, including how to prepare request and response payloads, as well as a usage example that uses the Azure REST API to obtain an OAuth 2.0 access token and then create an Event Grid topic.

Required parameter

Parameter Type Direction Description
APP_URL Text IN External API URL

Optional parameters

General

Parameter Type Direction Description
APP_TIMEOUT Numeric IN Maximum time interval between sending the request and receiving the response

The default is 30,000 milliseconds (30 seconds) and the maximum is 3,600,000 milliseconds (1 hour); the default can be modified by setting the RestApiClientRequestTimeout parameter value in the web.config file.

Note: This timeout value must be less than the IIS request timeout value.
APP_METHOD Text IN API method

The default is GET . Supports POST , PUT , DELETE , HEAD , PATCH
APP_REQUEST_CONTENT_TYPE Text IN Request content type supported by the external API

The application supports application/json and application/x-www-form-urlencoded ); the default is application/json .
APP_RESPONSE_IGNORE_ERROR Text IN When set to Y , the application will ignore the error when a WebException occurs or the external API returns a response status greater or equal to 300; the default is N .

APP_URL optional parameters

Parameter Type Direction Description
APP_URL_xxx Text IN API URL optional parameter where xxx is the URL parameter name

It must be defined in the APP_URL parameter value between brackets (e.g. APP_URL_subscriptionId for the URL https://management.azure.com/subscriptions/{subscriptionId} )

Example:

Parameter Type Direction Value
APP_URL Text IN https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}
APP_URL_subscriptionId Text IN 457a2a46-7a7f-4afa-940d-8779e1425fa8
APP_URL_resourceGroupName Text IN dev-group-advantys
APP_URL_topicName Text IN dev-topic

The parameters defined above will generate the following URL in APP_URL:

https://management.azure.com/subscriptions/457a2a46-7a7f-4afa-940d-8779e1425fa8/resourceGroups/dev-group-advantys/providers/Microsoft.EventGrid/topics/dev-topic

Header parameters

Parameter Type Direction Description
APP_HEADER_xxx Text IN External API header parameters where xxx is the header field name

Example:

Parameter Type Direction Value
APP_HEADER_Authorization Text IN Bearer AbCdEf123456
APP_HEADER_location Text IN canadaeast

‌The parameters defined above will generate two headers in the request payload:

Authorization: Bearer AbCdEf123456
location: canadaeast

Authorization parameters

The application also supports some predefined authorization header parameters in order to avoid adding these HTTP header parameters with the APP_HEADER_xxx parameter name.

Parameter Type Direction Description
APP_AUTH_BASIC_USERNAME Text IN API authorization Basic username
APP_AUTH_BASIC_PASSWORD Text IN API authorization Basic password; must be used with APP_AUTH_BASIC_USERNAME parameter
APP_AUTH_BEARER_TOKEN Text IN API authorization Bearer token
APP_AUTH_AZ_SAS_TOKEN Text IN API authorization Azure SAS token

Notes:

  • Only one authorization header can be defined, otherwise an exception is thrown.

  • APP_AUTH_BEARER_TOKEN is equivalent to defining the header parameter APP_HEADER_Authorization.

Can I use macros in the text value? I doesn’t seem to work.

I tried sending the text value of <WF_APP_SETTING_BearerToken>
for the parameter APP_AUTH_BEARER_TOKEN

It actually sends the string value instead of the macro’s value.

Nevermind, I forgot to set the EngineMacroAppSettings parameter.

It works.