# RESTAPICLIENT

## Overview

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).&#x20;

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

## How it works

* The RESTAPICLIENT application requires the `APP_URL` parameter, which corresponds to the REST API endpoint.<br>
* The default request payload content type (`APP_REQUEST_CONTENT_TYPE`) is `application/json`. `application/x-www-form-urlencoded` and `multipart/form-data` are also supported. Use `multipart/form-data` for file uploads (see the [`multipart/form-data` parameters](#multipart-form-data-parameters) section).<br>
* The default HTTP request method (`APP_METHOD`) is `GET`. Other request methods (`POST`, `PUT`, `DELETE`, etc.) are also supported.<br>
* In case of error, when the `APP_RESPONSE_IGNORE_ERROR` IN parameter is defined and has `Y` as its value, the error will be ignored and defined OUT parameters (`APP_RESPONSE_STATUS` or `APP_RESPONSE_CONTENT`) will be mapped. Otherwise, an exception will be thrown.<br>
* Since the application parameters are case sensitive, parameters must use the API’s accepted notation.<br>
* The default request timeout is 30,000 milliseconds (30 seconds); this default value can be modified by setting the `RestApiClientRequestTimeout` parameter value in the `web.config` file. The request timeout can also be defined in the `APP_TIMEOUT` IN parameter; the maximum timeout is 3,600,000 milliseconds (1 hour).<br>

  ✏️ **Note:** This timeout value must be less than the IIS request timeout value.<br>
* The HTTP request headers can be defined with the `APP_HEADER_xxx` parameters, where `xxx` is the header field name. For more information, see the [Header parameters](#header-parameters) section.<br>
* The request payload can be defined in the `APP_REQUEST_CONTENT_FILE` or `APP_REQUEST_CONTENT` IN parameters. When both parameters are defined, the `APP_REQUEST_CONTENT_FILE` parameter has priority. For more information on these parameters, see the [Request payload](#request-payload) section.<br>
* The response from the REST API can be mapped to the `APP_RESPONSE_CONTENT_FILE` or `APP_RESPONSE_CONTENT` OUT parameters. Both parameters can be defined at the same time. For more information on these parameters, see the [Response payload](#response-payload) section.<br>
* Besides the optional parameters listed below, you can also add additional custom IN and OUT parameters to send and receive custom user-defined data to and from the external API. For more information on and examples of these custom IN and OUT parameters, see the [Request payload](#request-payload) and [Response payload](#response-payload) sections.<br>
* The application supports the JSONPath query language (see [https://github.com/json-path/JsonPath](https://github.com/json-path/JsonPath/)), which allows extraction of specific data from a JSON response (similar to XPath expressions in XML). For information on how to use this with the application along with examples, see the [Response payload](#response-payload) section.<br>
* Application logs are available and can be specified by setting the `RestApiClientLogLevel` parameter value in the `web.config` file to `0` to disable logging (default), `2` for simple logs, or `3` for debug logs.<br>
* The default maximum response length is 4194304 characters (4 MB); this default value can be modified by setting the `RestApiClientMaxResponseLength` parameter value in the `web.config` file.<br>
* Automatic deletion of temporary files can be disabled by setting the `RestApiClientEnableFilesCleanUp` parameter value to `N` in the `web.config` file; the default value is `Y`.
* The `APP_RESPONSE_CONTENT_FILE` parameter automatically detects binary content types (PDF, images, ZIP, etc.) and saves them correctly without corruption. Use `APP_RESPONSE_CONTENT_FILENAME` to specify a custom filename.
* Authorization headers are automatically masked in log files for security (displays `***` followed by the last 4 characters of the token).
* Binary response content is summarized in logs (e.g. `[Binary content, 37228 bytes, application/octet-stream]`) to prevent log file bloat and ensure readability.

## Required parameter

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th width="134.47296142578125" valign="top">Type</th><th valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Description</strong></td></tr><tr><td valign="top"><code>APP_URL</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top">External API URL</td></tr></tbody></table>

## Optional parameters

### General

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Description</strong></td></tr><tr><td valign="top"><code>APP_TIMEOUT</code></td><td valign="top">NUMERIC</td><td valign="top">IN</td><td valign="top"><p>Maximum time interval between sending the request and receiving the response</p><p></p><p>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 <code>RestApiClientRequestTimeout</code> parameter value in the <code>web.config</code> file.</p><p></p><p>✏️ <strong>Note:</strong> This timeout value must be less than the IIS request timeout value.</p></td></tr><tr><td valign="top"><code>APP_METHOD</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><p>API method</p><p></p><p>The default is <code>GET</code>. Supports <code>POST</code>, <code>PUT</code>, <code>DELETE</code>, <code>HEAD</code>, <code>PATCH</code></p></td></tr><tr><td valign="top"><code>APP_REQUEST_CONTENT_TYPE</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><p>Request content type supported by the external API </p><p></p><p>The application supports <code>application/json</code>, <code>application/x-www-form-urlencoded</code>, and <code>multipart/form-data</code>; the default is <code>application/json</code>. Use <code>multipart/form-data</code> for file uploads to APIs.</p></td></tr><tr><td valign="top"><code>APP_RESPONSE_IGNORE_ERROR</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top">When set to <code>Y</code>, the application will ignore the error when a <code>WebException</code> occurs or the external API returns a response status equal to or greater than <code>300</code>; the default is <code>N</code>.</td></tr></tbody></table>

### `APP_URL` optional parameters

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Description</strong></td></tr><tr><td valign="top"><code>APP_URL_xxx</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><p>API URL optional parameter where <code>xxx</code> is the URL parameter name</p><p></p><p>It must be defined in the <code>APP_URL</code> parameter value between brackets (e.g. <code>APP_URL_subscriptionId</code> for the URL <code>https://management.azure.com/subscriptions/{subscriptionId}</code>)</p></td></tr></tbody></table>

📌 **Example**

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>APP_URL</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}</code></td></tr><tr><td valign="top"><code>APP_URL_subscriptionId</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>457a2a46-7a7f-4afa-940d-8779e1425fa8</code></td></tr><tr><td valign="top"><code>APP_URL_resourceGroupName</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>dev-group-advantys</code></td></tr><tr><td valign="top"><code>APP_URL_topicName</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>dev-topic</code></td></tr></tbody></table>

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

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

### Header parameters

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Description</strong></td></tr><tr><td valign="top"><code>APP_HEADER_xxx</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top">External API header parameters where <code>xxx</code> is the header field name</td></tr></tbody></table>

#### 📌 Example

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>APP_HEADER_Authorization</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>Bearer AbCdEf123456</code></td></tr><tr><td valign="top"><code>APP_HEADER_location</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>canadaeast</code></td></tr></tbody></table>

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.

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Description</strong></td></tr><tr><td valign="top"><code>APP_AUTH_BASIC_USERNAME</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top">API authorization Basic username</td></tr><tr><td valign="top"><code>APP_AUTH_BASIC_PASSWORD</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top">API authorization Basic password; must be used with <code>APP_AUTH_BASIC_USERNAME</code> parameter</td></tr><tr><td valign="top"><code>APP_AUTH_BEARER_TOKEN</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top">API authorization Bearer token</td></tr><tr><td valign="top"><code>APP_AUTH_AZ_SAS_TOKEN</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top">API authorization Azure SAS token</td></tr></tbody></table>

{% hint style="info" %}

* Only one authorization header can be defined, otherwise an exception is thrown.<br>
* `APP_AUTH_BEARER_TOKEN` is equivalent to defining the header parameter `APP_HEADER_Authorization`.
  {% endhint %}

#### `multipart/form-data` parameters

When `APP_REQUEST_CONTENT_TYPE` is set to `multipart/form-data`, use the following parameters to upload files and send form data to APIs.

<table><thead><tr><th valign="top">Parameter</th><th width="156.5390625" valign="top">Type</th><th valign="top">Direction</th><th>Description</th></tr></thead><tbody><tr><td valign="top"><code>APP_FORMFILE_xxx</code></td><td valign="top">FILE</td><td valign="top">IN</td><td>File to upload where <code>xxx</code> is the form field name expected by the API (e.g. <code>APP_FORMFILE_file</code> creates a form field named <code>file</code>)</td></tr><tr><td valign="top"><code>APP_FORMDATA_xxx</code></td><td valign="top">TEXT, NUMERIC, or DATETIME</td><td valign="top">IN</td><td>Form data field where <code>xxx</code> is the field name (e.g. <code>APP_FORMDATA_purpose</code> creates a field named <code>purpose</code>)</td></tr></tbody></table>

#### **Supported data types for `APP_FORMDATA_xxx`**

<table><thead><tr><th valign="top">Type</th><th valign="top">Format</th></tr></thead><tbody><tr><td valign="top">TEXT</td><td valign="top">Sent as-is</td></tr><tr><td valign="top">NUMERIC</td><td valign="top">Formatted with invariant culture (e.g. <code>1234.56</code>)</td></tr><tr><td valign="top">DATETIME</td><td valign="top">Formatted as ISO 8601 (e.g. <code>2026-01-09T12:30:00Z</code>)</td></tr></tbody></table>

**📌 Example: Upload file to OpenAI Files API**

<table><thead><tr><th width="253.663818359375" valign="top">Parameter</th><th width="124.11395263671875" valign="top">Type</th><th width="123.74639892578125" valign="top">Direction</th><th>Value</th></tr></thead><tbody><tr><td valign="top"><code>APP_URL</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td><code>https://api.openai.com/v1/files</code></td></tr><tr><td valign="top"><code>APP_METHOD</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td><code>POST</code></td></tr><tr><td valign="top"><code>APP_REQUEST_CONTENT_TYPE</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td><code>multipart/form-data</code></td></tr><tr><td valign="top"><code>APP_AUTH_BEARER_TOKEN</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td><code>sk-xxx</code></td></tr><tr><td valign="top"><code>APP_FORMFILE_file</code></td><td valign="top">FILE</td><td valign="top">IN</td><td>(file to upload)</td></tr><tr><td valign="top"><code>APP_FORMDATA_purpose</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td><code>assistants</code></td></tr><tr><td valign="top"><code>id</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td><code>DATA_FILE_ID</code></td></tr></tbody></table>

The parameters defined above will generate a multipart request equivalent to:

```bash
curl https://api.openai.com/v1/files \
  -H "Authorization: Bearer sk-xxx" \
  -F "file=@myfile.pdf" \
  -F "purpose=assistants"
```

**📌 Example: Upload file to Mistral Files API (OCR)**

<table><thead><tr><th width="249.23211669921875">Parameter</th><th width="124.826171875">Type</th><th width="126.30767822265625">Direction</th><th>Value</th></tr></thead><tbody><tr><td><code>APP_URL</code></td><td>TEXT</td><td>IN</td><td><code>https://api.mistral.ai/v1/files</code></td></tr><tr><td><code>APP_METHOD</code></td><td>TEXT</td><td>IN</td><td><code>POST</code></td></tr><tr><td><code>APP_REQUEST_CONTENT_TYPE</code></td><td>TEXT</td><td>IN</td><td><code>multipart/form-data</code></td></tr><tr><td><code>APP_AUTH_BEARER_TOKEN</code></td><td>TEXT</td><td>IN</td><td>Mistral API key</td></tr><tr><td><code>APP_FORMFILE_file</code></td><td>FILE</td><td>IN</td><td>PDF or image file</td></tr><tr><td><code>APP_FORMDATA_purpose</code></td><td>TEXT</td><td>IN</td><td><code>ocr</code></td></tr><tr><td><code>id</code></td><td>TEXT</td><td>OUT</td><td><code>DATA_FILE_ID</code></td></tr></tbody></table>

{% hint style="info" %}
Mistral OCR supports PDF, images, Word (`.docx`), PowerPoint (`.pptx`), and EPUB files. HTML is not supported.
{% endhint %}

{% hint style="warning" %}

* When `APP_REQUEST_CONTENT_TYPE` is set to `multipart/form-data`, standard IN parameters (not prefixed with `APP_FORMFILE_` or `APP_FORMDATA_`) are not included in the request.
* The file's original filename and content type are preserved in the upload.
* Multiple files can be uploaded by defining multiple `APP_FORMFILE_xxx` parameters with different field names.
  {% endhint %}

### Request payload

{% hint style="info" %}
The request payload parameters described in this section apply to `application/json` and `application/x-www-form-urlencoded` content types. For `multipart/form-data` requests (file uploads), see the [`multipart/form-data` parameters](#multipart-form-data-parameters) section.
{% endhint %}

There are two different ways to prepare the request payload. The first way is when you have access to the whole request payload (see [Set the whole request payload via a parameter](#set-the-whole-request-payload-via-a-parameter) below); the second way is by building the JSON or URL encoded payload via IN parameters (see [URL encoded request payload](#url-encoded-request-payload) and [JSON request payload](#json-request-payload) below).

#### Set the whole request payload via a parameter

The following parameters can be used when you have access to the whole request payload, or the request content type is neither `application/json` nor `application/x-www-form-urlencoded`. You can set this request payload in a file/text data or directly in the text value.

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Description</strong></td></tr><tr><td valign="top"><code>APP_REQUEST_CONTENT_FILE</code></td><td valign="top">FILE</td><td valign="top">IN</td><td valign="top">Request payload in a file</td></tr><tr><td valign="top"><code>APP_REQUEST_CONTENT</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top">Request payload</td></tr></tbody></table>

{% hint style="info" %}

* `APP_REQUEST_CONTENT_FILE` has priority over `APP_REQUEST_CONTENT`.<br>
* `APP_REQUEST_CONTENT` has priority over IN parameters used to build a JSON or an URL encoded payload.
  {% endhint %}

#### URL encoded request payload

The following examples show how to build a request payload with `application/x-www-form-urlencoded` as content type.

**Standard URL encoded request payload**

The following parameters are used to build a standard URL encoded request payload:

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Description</strong></td></tr><tr><td valign="top"><code>param1</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>value1</code></td></tr><tr><td valign="top"><code>param2</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>value2</code></td></tr></tbody></table>

The parameters defined above will generate the following request payload:

```
param1=value1&param2=value2
```

**JSON request payload encoded into a key name**

The following parameters are used to build a JSON payload encoded into a key name:

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Description</strong></td></tr><tr><td valign="top"><code>param1</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>value1</code></td></tr><tr><td valign="top"><code>param2</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>value2</code></td></tr><tr><td valign="top"><code>APP_REQUEST_CONTENT_PAYLOAD_NAME</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>payload</code></td></tr></tbody></table>

The parameters defined above will generate the following request payload:

```
payload: { param1: "value1", "param2": "value2" }
```

{% hint style="info" %}
The `APP_REQUEST_CONTENT_PAYLOAD_NAME` parameter is only supported with the `application/x-www-form-urlencoded` request content type.
{% endhint %}

#### JSON request payload

The following examples show how to build a request payload with `application/json` as content type.

**Standard JSON request payload**

The following parameters are used to build a simple JSON request payload:

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>person.address.street</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>160 Guy Street</code></td></tr><tr><td valign="top"><code>person.address.zipcode</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>J4G 1U4</code></td></tr><tr><td valign="top"><code>person.age</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>30</code></td></tr><tr><td valign="top"><code>person.name</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>John</code></td></tr></tbody></table>

The parameters defined above will generate the following request payload:

```json
{
    "person": {
        "address": {
            "street": "160 Guy Street",
            "zipcode": "J4G 1U4"
        },
        "age": 30,
        "name": "John"
    }
}
```

If you want to convert this JSON into an array, you have to set the `APP_REQUEST_CONTENT_IS_ARRAY` parameter value to `Y`.

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Description</strong></td></tr><tr><td valign="top"><code>APP_REQUEST_CONTENT_IS_ARRAY</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><p>When set to <code>Y</code>, the application will convert the JSON request payload into an array; the default is <code>N</code></p><p></p><p>Only supported when building JSON request payload with IN parameters.</p></td></tr></tbody></table>

Setting the `APP_REQUEST_CONTENT_IS_ARRAY` parameter to `Y` will generate the following request payload:

```json
[{
    "person": {
        "address": {
            "street": "160 Guy Street",
            "zipcode": "J4G 1U4"
        },
        "age": 30,
        "name": "John"
    }
}]
```

To see how to build more complex JSON, see [Setting a JSON array into a JSON property](#setting-a-json-array-into-a-json-property) and [Setting a JSON object/array into a JSON property using the `__JSON` suffix parameter](#setting-a-json-object-array-into-a-json-property-using-the-__json-suffix-parameter) sections below.

#### **Setting a JSON array into a JSON property**

To set an array into a JSON property, you have to define the property path (e.g. `person.spokenlanguages`) followed by the `__X` suffix, where `X` is the array index number.

The following parameters are used to set a JSON array into a JSON property:

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>person.spokenlanguages__0</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>french</code></td></tr><tr><td valign="top"><code>person.spokenlanguages__1</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>english</code></td></tr><tr><td valign="top"><code>person.spokenlanguages__2</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>chinese</code></td></tr></tbody></table>

The parameters defined above will generate the following request payload:

```json
{
    "person": {
        "spokenlanguages": ["french", "english", "chinese"]
    }
}
```

If you want to set a JSON array of JSON objects (e.g. `"spokenlanguages": [{"spokenlanguage":"french"}, {"spokenlanguage":"english"}]`) into a JSON property, see the next section.

{% hint style="warning" %}

* The array parameters will be ordered depending on their index number.<br>
* Index numbers have no limit (e.g. `person.spokenlanguages__9999`).<br>
* A correct index sequence is not mandatory (e.g. `person.spokenlanguages__90`, `person.spokenlanguages__30`). The `__30` parameter value will be the first array parameter, and `__90` the second one. <br>
* An exception will be thrown if there is more than one JSON property specified in the IN parameters (e.g. `person.spokenlanguages` and `person.spokenlanguages__0`).<br>
* The `__X` suffix uses **two** underscore characters.<br>
* The parameter value can only be a text value.
  {% endhint %}

#### **Setting a JSON object/array into a JSON property using the `__JSON` suffix parameter**

To set a JSON object/array into a JSON property, you have to define the property path (e.g. `person.children`) followed by the `__JSON` suffix  with the JSON object/array as the parameter value.

The following parameters are used to set a JSON object/array into a JSON property:

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>person.children__JSON</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>[{"name": "child 1"}, {"name": "child 2"}]</code></td></tr></tbody></table>

The parameters defined above will generate the following request payload:

```json
{
    "person": {
        "children": [{
            "name": "child 1"
        }, {
            "name": "child 2"
        }]
    }
}
```

{% hint style="warning" %}

* An exception will be thrown if there is more than one JSON property specified in the IN parameters. (e.g. `person.children` and `person.children__JSON`).<br>
* The `__JSON` suffix uses **two** underscore characters.
  {% endhint %}

### Response payload

The application supports OUT parameters to be mapped with the HTTP response:

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Description</strong></td></tr><tr><td valign="top"><code>APP_RESPONSE_STATUS</code></td><td valign="top">TEXT/NUMERIC</td><td valign="top">OUT</td><td valign="top">Response status code</td></tr><tr><td valign="top"><code>APP_RESPONSE_CONTENT_TYPE</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top">Response content type</td></tr><tr><td valign="top"><code>APP_RESPONSE_CONTENT_FILE</code></td><td valign="top">FILE</td><td valign="top">OUT</td><td valign="top"><p>Response payload saved as a file </p><p><br>Automatically detects binary content types (PDF, images, ZIP, etc.) and saves them correctly without corruption. Text content types (JSON, XML, HTML) are saved as UTF-8 text.</p></td></tr><tr><td valign="top"><code>APP_RESPONSE_CONTENT_FILENAME</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top">Optional. Specifies a custom filename for the <code>APP_RESPONSE_CONTENT_FILE</code> output. If not specified, the filename is determined from the <code>Content-Disposition</code> header or defaults to <code>response.[extension]</code> based on content type.</td></tr><tr><td valign="top"><code>APP_RESPONSE_CONTENT</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top">Response payload or error message</td></tr><tr><td valign="top"><code>APP_RESPONSE_CONTENT_IS_ARRAY</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top"><p>Returns <code>Y</code> if the JSON payload is an array</p><p></p><p>Only supported for <code>application/json</code> content type responses.</p></td></tr></tbody></table>

### **Binary vs text content types**

`APP_RESPONSE_CONTENT_FILE` automatically detects the content type and uses the appropriate save method:

#### **Text content types (saved as UTF-8 text)**

* `text/*` (text/plain, text/html, text/csv, text/xml, etc.)
* `application/json`, `application/ld+json`
* `application/xml`, `application/xhtml+xml`
* `application/javascript`
* `application/yaml`, `application/toml`
* `application/sql`, `application/graphql`

#### **Binary content types (saved as raw bytes)**

* `application/pdf`
* `application/octet-stream`
* `application/zip`, `application/gzip`, `application/x-tar`
* `application/vnd.*` (Microsoft 365 documents: `docx`, `xlsx`, `pptx`)
* `image/*` (`jpeg`, `png`, `gif`, `webp`, etc.)
* `audio/*` (`mp3`, `wav`, `ogg`, etc.)
* `video/*` (`mp4`, `webm`, `mov`, etc.)

#### **Filename resolution**

The filename for `APP_RESPONSE_CONTENT_FILE` is determined in this priority order:

1. **`Content-Disposition` header**:  If the API returns `Content-Disposition: attachment; filename="report.pdf"`, that filename is used.
2. **`APP_RESPONSE_CONTENT_FILENAME` parameter**: If specified by the user.
3. **Fallback:** `response.[extension]`, where `extension` is derived from the content type (e.g. `response.pdf` for `application/pdf`; `response.bin` for `application/octet-stream`).

**📌 Example: Download file from OpenAI**

| Parameter                   | Type | Direction | Value                                               |
| --------------------------- | ---- | --------- | --------------------------------------------------- |
| `APP_URL`                   | TEXT | IN        | `https://api.openai.com/v1/files/{file_id}/content` |
| `APP_URL_file_id`           | TEXT | IN        | `file-abc123`                                       |
| `APP_METHOD`                | TEXT | IN        | `GET`                                               |
| `APP_AUTH_BEARER_TOKEN`     | TEXT | IN        | `sk-xxx`                                            |
| `APP_RESPONSE_CONTENT_FILE` | FILE | OUT       | `DATA_DOWNLOADED_FILE`                              |

{% hint style="info" %}
OpenAI only allows downloading files with `purpose: batch` or `purpose: fine-tune`. Files with `purpose: assistants` or `purpose: user_data` cannot be downloaded via the `/content` endpoint.
{% endhint %}

**📌 Example: Download file from Mistral (with custom filename)**

| Parameter                       | Type | Direction | Value                                               |
| ------------------------------- | ---- | --------- | --------------------------------------------------- |
| `APP_URL`                       | TEXT | IN        | `https://api.mistral.ai/v1/files/{file_id}/content` |
| `APP_URL_file_id`               | TEXT | IN        | File ID                                             |
| `APP_METHOD`                    | TEXT | IN        | `GET`                                               |
| `APP_AUTH_BEARER_TOKEN`         | TEXT | IN        | Mistral API key                                     |
| `APP_RESPONSE_CONTENT_FILENAME` | TEXT | IN        | `my_document.pdf`                                   |
| `APP_RESPONSE_CONTENT_FILE`     | FILE | OUT       | `DATA_DOWNLOADED_FILE`                              |

{% hint style="warning" %}
Mistral's `/content` endpoint returns `application/octet-stream` without a `Content-Disposition` header. You **must** specify `APP_RESPONSE_CONTENT_FILENAME` to get the correct filename and extension. Without it, the file will be saved as `response.bin`.
{% endhint %}

#### Mapping a JSON response payload with OUT parameters

The application also supports additional custom OUT parameters to map simple JSON response payloads.

📌 **Example**

JSON response payload:

```json
{
    "person": {
        "address": {
            "street": "160 Guy Street",
            "zipcode": "J4G 1U4"
        },
        "age": 30,
        "name": "John"
    }
}
```

The following parameters allow you to map the response payload into different process data:

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Retrieve the value into a data</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Retrieve the value into a data</strong></td></tr><tr><td valign="top"><code>person.address.street</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top"><code>DATA_STREET</code></td></tr><tr><td valign="top"><code>person.address.zipcode</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top"><code>DATA_ZIPCODE</code></td></tr><tr><td valign="top"><code>person.age</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top"><code>DATA_AGE</code></td></tr><tr><td valign="top"><code>person.name</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top"><code>DATA_NAME</code></td></tr></tbody></table>

For mapping complex JSON, see the next section.

#### Mapping a JSON response payload with OUT parameters using JSONPath query language

The application supports the JSONPath query language (similar to XPath expressions in XML). This language allows you to retrieve specific data from a JSON. For more details regarding the JSONPath syntax, see <https://github.com/json-path/JsonPath>.

📌 **Example**

JSON response payload:

```json
{
    "person": {
      "name": "Elizabeth",
      "age": 85,
      "dob": "1937-09-23T00:00:00Z",
      "children": [
        {
          "name": "Charles",
          "age": 60,
          "children": [
            {
              "name": "Nathalie",
              "children": [
                {
                  "name": "George",
                  "age": 8
                },
                {
                  "name": "Charlotte",
                  "age": 10
                },
                {
                  "name": "Jefferson",
                  "age": 7
                }
              ]
            },
            {
              "name": "Harry"
            }
          ]
        },
        {
          "name": "Bob",
          "age": 57,
          "children": [
            {
              "name": "John"
            },
            {
              "name": "Mark"
            }
          ]
        }
      ]
    }
}
```

For example, here we want to get the names of Charles's grandchildren who are older than seven years old, and we also want these names separated by a `|` (using the `APP_JSONPATH_DELIMITER` IN parameter). At the same time, we are also getting Elizabeth's age and date of birth. To get the information, the following parameters must be defined:

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">IN Value</th><th>OUT Value</th></tr></thead><tbody><tr><td valign="top"><code>APP_JSONPATH_DELIMITER</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>|</code></td><td></td></tr><tr><td valign="top"><code>PARAM1__JSONPATH</code></td><td valign="top">TEXT</td><td valign="top">INOUT</td><td valign="top"><code>person.children[?(@.name == 'Charles')].children[*].children[?(@.age > 7)].name</code></td><td>data <code>DATA1_VALUE</code> (value will be: <code>George|Charlotte</code>)</td></tr><tr><td valign="top"><code>AGE__JSONPATH</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>$.person.age</code></td><td></td></tr><tr><td valign="top"><code>AGE</code></td><td valign="top">NUMERIC</td><td valign="top">OUT</td><td valign="top"></td><td>data <code>AGE_VALUE</code> (value will be: <code>85</code>)</td></tr><tr><td valign="top"><code>DOB__JSONPATH</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>$.person.dob</code></td><td></td></tr><tr><td valign="top"><code>DOB</code></td><td valign="top">DATETIME</td><td valign="top">OUT</td><td valign="top"></td><td>data <code>DOB_VALUE</code> (value will be: <code>1937-09-23T00:00:00Z</code>)</td></tr></tbody></table>

{% hint style="warning" %}

* In the `PARAM1__JSONPATH` parameter name, the `PARAM1` name is not relevant, but it must be followed by the `__JSONPATH` suffix (**two** underscores are used in the suffix).<br>
* To retrieve a value into a **Text** process data, you can use a single INOUT Text parameter (e.g. `PARAM1__JSONPATH` parameter as in the example above).<br>
* To retrieve a value into a **Numeric** or **DateTime** process data, you **must** use separate parameters: an IN Text parameter for the JSONPath query and an OUT parameter that maps to the Numeric or DateTime process data. Both parameters must share the same name prefix (e.g. `AGE__JSONPATH` and `AGE` parameters as in the example above).<br>
* The default value of `APP_JSONPATH_DELIMITER` is a comma (`,`) when this parameter is not defined.
  {% endhint %}

## Usage example with Azure REST API to obtain an OAuth 2.0 access token and then create an Event Grid topic

This example shows how to obtain an access token and use it to create an Event Grid topic. This can be done by creating a process with two actions having RESTAPICLIENT as application. The workflow below illustrates this example:

<div align="left"><img src="https://user-images.githubusercontent.com/22150605/56391674-54de8480-61fd-11e9-8b6b-5645563e0d6d.png" alt=""></div>

The next sections describe the parameters that must be declared for each action.

### `GET_TOKEN` action: Obtaining an OAuth 2.0 access token

The following parameters are needed to get an access token to use the Azure Resource management API. This token will be stored in the `access_token` OUT parameter and will be used when creating an Event Grid topic in the next section.

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>APP_URL</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>https://login.microsoftonline.com/{tenandId}/oauth2/token</code></td></tr><tr><td valign="top"><code>APP_URL_tenantId</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>a6e70c61-fabd-4885-89f7-97121e92db7f</code></td></tr><tr><td valign="top"><code>APP_METHOD</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>POST</code></td></tr><tr><td valign="top"><code>APP_REQUEST_CONTENT_TYPE</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>application/x-www-form-urlencoded</code></td></tr><tr><td valign="top"><code>grant_type</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>client_credentials</code></td></tr><tr><td valign="top"><code>client_id</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>b7e29e2f-6e2b-4375-9684-8151431d4ca6</code></td></tr><tr><td valign="top"><code>client_secret</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>lxy/IwKyTedHUWMeeUtyCtu7/YUy0rNGoY3NNWXXotI=</code></td></tr><tr><td valign="top"><code>resource</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>https://management.core.windows.net/</code></td></tr><tr><td valign="top"><code>access_token</code></td><td valign="top">Text</td><td valign="top">OUT</td><td valign="top"><code>DATA_ACCESS_TOKEN</code></td></tr></tbody></table>

The parameters defined above will generate the following request payload:

```http
POST https://login.microsoftonline.com/a6e70c61-fabd-4885-89f7-97121e92db7f/oauth2/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&client_id=b7e29e2f-6e2b-4375-9684-8151431d4ca6&client_secret=lxy/IwKyTedHUWMeeUtyCtu7/YUy0rNGoY3NNWXXotI=&resource=https://management.core.windows.net/
```

Here's the response from the Azure API:

```json
{  
   "token_type":"Bearer",
   "expires_in":"3600",
   "ext_expires_in":"3600",
   "expires_on":"1555951493",
   "not_before":"1555947593",
   "resource":"https://management.core.windows.net/",
   "access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1d..."
}
```

{% hint style="info" %}
The `access_token` OUT parameter is mapped with the `access_token` JSON property.
{% endhint %}

For more details about how to get an access token to use the Azure Resource API, see <https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-oauth2-client-creds-grant-flow#request-an-access-token>.

### `CREATE_TOPIC` action: Creating an Event Grid topic

The following parameters are needed to create an Event Grid topic using the Azure Resource management API.

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>APP_URL</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}?api-version={api-version}</code></td></tr><tr><td valign="top"><code>APP_URL_subscriptionId</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>235765d9-5d62-43f4-a730-2ed71a3f8adb</code></td></tr><tr><td valign="top"><code>APP_URL_resourceGroupName</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>dev-group-advantys</code></td></tr><tr><td valign="top"><code>APP_URL_topicName</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>new-topic-example</code></td></tr><tr><td valign="top"><code>APP_URL_api-version</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>2018-09-15-preview</code></td></tr><tr><td valign="top"><code>APP_METHOD</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>PUT</code></td></tr><tr><td valign="top"><code>APP_REQUEST_CONTENT_TYPE</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>application/json</code></td></tr><tr><td valign="top"><code>APP_AUTH_BEARER_TOKEN</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>DATA_ACCESS_TOKEN</code></td></tr><tr><td valign="top"><code>location</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>canadaeast</code></td></tr></tbody></table>

The parameters defined above will generate the following request payload:

```http
PUT https://management.azure.com/subscriptions/235765d9-5d62-43f4-a730-2ed71a3f8adb/resourceGroups/dev-group-advantys/providers/Microsoft.EventGrid/topics/new-topic-example?api-version=2018-09-15-preview
Host: management.azure.com
Content-Type: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1d...
location: canadaeast
```

Here's the response from the Azure API:

```json
{  
   "properties":{  
      "provisioningState":"Creating",
      "endpoint":null
   },
   "location":"canadaeast",
   "tags":null,
   "id":"/subscriptions/994e2fc0-937d-4110-b355-e7473acef822/resourceGroups/dev-evt-grid/providers/Microsoft.EventGrid/topics/test-from-wfg",
   "name":"test-from-wfg",
   "type":"Microsoft.EventGrid/topics"
}
```

For more information about how to create an Event Grid topic and the Azure REST API, see <https://docs.microsoft.com/en-us/rest/api/eventgrid/topics/createorupdate>.

## Usage example with OpenAI Files API

This example shows how to upload a file to OpenAI, list files, download a file, and delete a file using RESTAPICLIENT.

### **`UPLOAD_FILE` action: Uploading a file**

| Parameter                  | Type    | Direction | Value                             |
| -------------------------- | ------- | --------- | --------------------------------- |
| `APP_URL`                  | TEXT    | IN        | `https://api.openai.com/v1/files` |
| `APP_METHOD`               | TEXT    | IN        | `POST`                            |
| `APP_REQUEST_CONTENT_TYPE` | TEXT    | IN        | `multipart/form-data`             |
| `APP_AUTH_BEARER_TOKEN`    | TEXT    | IN        | API key                           |
| `APP_FORMFILE_file`        | FILE    | IN        | File to upload                    |
| `APP_FORMDATA_purpose`     | TEXT    | IN        | `batch`                           |
| `APP_RESPONSE_STATUS`      | NUMERIC | OUT       | `DATA_STATUS`                     |
| `id`                       | TEXT    | OUT       | `DATA_FILE_ID`                    |
| `filename`                 | TEXT    | OUT       | `DATA_FILENAME`                   |

Here's the response from the OpenAI API:

```json
{
  "id": "file-abc123",
  "object": "file",
  "bytes": 120000,
  "created_at": 1677610602,
  "filename": "myfile.jsonl",
  "purpose": "batch"
}
```

### **`LIST_FILES` action: Listing uploaded files**

| Parameter               | Type    | Direction | Value                             |
| ----------------------- | ------- | --------- | --------------------------------- |
| `APP_URL`               | TEXT    | IN        | `https://api.openai.com/v1/files` |
| `APP_METHOD`            | TEXT    | IN        | `GET`                             |
| `APP_AUTH_BEARER_TOKEN` | TEXT    | IN        | API key                           |
| `APP_RESPONSE_STATUS`   | NUMERIC | OUT       | `DATA_STATUS`                     |
| `APP_RESPONSE_CONTENT`  | TEXT    | OUT       | `DATA_RESPONSE`                   |
| `object`                | TEXT    | OUT       | `DATA_OBJECT`                     |

### **`DOWNLOAD_FILE` action: Downloading file content**

| Parameter                   | Type | Direction | Value                                               |
| --------------------------- | ---- | --------- | --------------------------------------------------- |
| `APP_URL`                   | TEXT | IN        | `https://api.openai.com/v1/files/{file_id}/content` |
| `APP_URL_file_id`           | TEXT | IN        | `DATA_FILE_ID`                                      |
| `APP_METHOD`                | TEXT | IN        | `GET`                                               |
| `APP_AUTH_BEARER_TOKEN`     | TEXT | IN        | API key                                             |
| `APP_RESPONSE_CONTENT_FILE` | FILE | OUT       | `DATA_DOWNLOADED_FILE`                              |

{% hint style="info" %}
Only files with `purpose: batch` or `purpose: fine-tune` can be downloaded. Files with `purpose: assistants` or `purpose: user_data` will return a `400` error.
{% endhint %}

### **`DELETE_FILE` action: Deleting a file**

| Parameter               | Type    | Direction | Value                                       |
| ----------------------- | ------- | --------- | ------------------------------------------- |
| `APP_URL`               | TEXT    | IN        | `https://api.openai.com/v1/files/{file_id}` |
| `APP_URL_file_id`       | TEXT    | IN        | `DATA_FILE_ID`                              |
| `APP_METHOD`            | TEXT    | IN        | `DELETE`                                    |
| `APP_AUTH_BEARER_TOKEN` | TEXT    | IN        | API key                                     |
| `APP_RESPONSE_STATUS`   | NUMERIC | OUT       | `DATA_STATUS`                               |
| `id`                    | TEXT    | OUT       | `DATA_FILE_ID`                              |
| `deleted`               | TEXT    | OUT       | `DATA_DELETED`                              |

### Usage example with Mistral Files API

This example shows how to upload a file to Mistral for OCR, get a signed download URL, download the file, and delete it.

### **`UPLOAD_FILE` action: Uploading a file for OCR**

| Parameter                  | Type    | Direction | Value                             |
| -------------------------- | ------- | --------- | --------------------------------- |
| `APP_URL`                  | TEXT    | IN        | `https://api.mistral.ai/v1/files` |
| `APP_METHOD`               | TEXT    | IN        | `POST`                            |
| `APP_REQUEST_CONTENT_TYPE` | TEXT    | IN        | `multipart/form-data`             |
| `APP_AUTH_BEARER_TOKEN`    | TEXT    | IN        | API key                           |
| `APP_FORMFILE_file`        | FILE    | IN        | PDF or image file                 |
| `APP_FORMDATA_purpose`     | TEXT    | IN        | `ocr`                             |
| `APP_RESPONSE_STATUS`      | NUMERIC | OUT       | `DATA_STATUS`                     |
| `id`                       | TEXT    | OUT       | `DATA_FILE_ID`                    |
| `filename`                 | TEXT    | OUT       | `DATA_FILENAME`                   |

{% hint style="info" %}
Mistral OCR supports PDF, images, Word (`.docx`), PowerPoint (`.pptx`), and EPUB files. HTML is not supported.
{% endhint %}

### **`RETRIEVE_FILE` action: Getting file metadata**

| Parameter               | Type | Direction | Value                                       |
| ----------------------- | ---- | --------- | ------------------------------------------- |
| `APP_URL`               | TEXT | IN        | `https://api.mistral.ai/v1/files/{file_id}` |
| `APP_URL_file_id`       | TEXT | IN        | `DATA_FILE_ID`                              |
| `APP_METHOD`            | TEXT | IN        | `GET`                                       |
| `APP_AUTH_BEARER_TOKEN` | TEXT | IN        | API key                                     |
| `filename`              | TEXT | OUT       | `DATA_FILENAME`                             |
| `purpose`               | TEXT | OUT       | `DATA_PURPOSE`                              |

### **`GET_SIGNED_URL` action: Getting a signed download URL**

Get a temporary signed URL for downloading the file. This is useful for sharing or delayed downloads.

| Parameter               | Type    | Direction | Value                                           |
| ----------------------- | ------- | --------- | ----------------------------------------------- |
| `APP_URL`               | TEXT    | IN        | `https://api.mistral.ai/v1/files/{file_id}/url` |
| `APP_URL_file_id`       | TEXT    | IN        | `DATA_FILE_ID`                                  |
| `APP_METHOD`            | TEXT    | IN        | `GET`                                           |
| `APP_AUTH_BEARER_TOKEN` | TEXT    | IN        | API key                                         |
| `APP_RESPONSE_STATUS`   | NUMERIC | OUT       | `DATA_STATUS`                                   |
| `url`                   | TEXT    | OUT       | `DATA_SIGNED_URL`                               |

Here's the response from the Mistral API:

```json
{
  "url": "https://mistralaifilesapiprodswe.blob.core.windows.net/fine-tune/.../file.pdf?se=2026-01-10T22%3A00%3A00Z&sp=r&sv=2025-01-05&sr=b&sig=..."
}
```

{% hint style="info" %}
The signed URL expires after 24 hours by default. Add `?expiry=48` to the request URL for a custom expiry (in hours).
{% endhint %}

### **`DOWNLOAD_FILE` action: Downloading file content directly**

| Parameter                       | Type | Direction | Value                                               |
| ------------------------------- | ---- | --------- | --------------------------------------------------- |
| `APP_URL`                       | TEXT | IN        | `https://api.mistral.ai/v1/files/{file_id}/content` |
| `APP_URL_file_id`               | TEXT | IN        | `DATA_FILE_ID`                                      |
| `APP_METHOD`                    | TEXT | IN        | `GET`                                               |
| `APP_AUTH_BEARER_TOKEN`         | TEXT | IN        | API key                                             |
| `APP_RESPONSE_CONTENT_FILENAME` | TEXT | IN        | `DATA_FILENAME`                                     |
| `APP_RESPONSE_CONTENT_FILE`     | FILE | OUT       | `DATA_DOWNLOADED_FILE`                              |

{% hint style="warning" %}
You must specify `APP_RESPONSE_CONTENT_FILENAME` when downloading from Mistral. The API returns `application/octet-stream` without a filename. Use the `filename` from the retrieve/upload response, or specify your own (e.g. `document.pdf`).
{% endhint %}

### **`DELETE_FILE` action: Deleting a file**

| Parameter               | Type    | Direction | Value                                       |
| ----------------------- | ------- | --------- | ------------------------------------------- |
| `APP_URL`               | TEXT    | IN        | `https://api.mistral.ai/v1/files/{file_id}` |
| `APP_URL_file_id`       | TEXT    | IN        | `DATA_FILE_ID`                              |
| `APP_METHOD`            | TEXT    | IN        | `DELETE`                                    |
| `APP_AUTH_BEARER_TOKEN` | TEXT    | IN        | API key                                     |
| `APP_RESPONSE_STATUS`   | NUMERIC | OUT       | `DATA_STATUS`                               |
| `id`                    | TEXT    | OUT       | `DATA_FILE_ID`                              |
| `deleted`               | TEXT    | OUT       | `DATA_DELETED`                              |

## Enabling SSL/TLS

In case of a `Could not create SSL/TLS secure channel` error, strong encryption must be enabled by executing the following code in PowerShell:

```csharp
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord

Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWo
```

{% hint style="warning" %}
Restart your IIS server after executing the commands.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.workflowgen.com/admin/workflow-applications/restapiclient-workflow-application.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
