Outbound Proxy API Store Response Binary Stage
The Outbound Proxy API Store Response Binary stage allows a remote API to be called and a binary response, such as a PDF or image, output as a new message.
Stage Overview
The Outbound Proxy API Store Response Binary stage allows a remote API service to be called from Integration Hub, and for a binary response (e.g. a PDF or an image) from the remote API to be output as a message in Integration Hub for further processing in the integration.
The response body is Base64 encoded and output in a JSON payload, together with the file name supplied by the remote API (if any). This allows the payload to be passed directly to a stage that expects a binary file payload, such as an Outbound Blob Binary, Outbound SFTP Binary, or Outbound SharePoint Binary stage.
For calling a remote API that returns a text-based (e.g. JSON) response, see the Outbound Proxy API Store Response stage.
Stage Definition File Location
All Outbound Proxy API Store Response Binary stages are defined by creating an appropriately formatted JSON definition file in the following location:
Stage JSON Definition File Format
The JSON definition file for an Outbound Proxy API Store Response Binary stage is as follows:
{
"name": "api-name",
"operation": "operation-name",
"displayName": "Brief Stage Title",
"description": "Brief description of the stage.",
"enabled": "$env:STATUS_<INTEGRATION_NAME>",
"source": "source-event",
"concurrency": 10,
"externalApiBaseUrl": "$env:BASE_URL",
"externalApiUrlPath": "$env:API_PATH",
"httpMethod": "GET|POST|PUT|PATCH|DELETE",
"header": {
// Custom Headers
},
"httpParametersMode": "none|parameter|REST",
"authentication": {
// See Authentication Options Below
},
"additionalRetryHttpCodes": [
409
],
"retryOn4xx": {
"errorCodePath": "error.code",
"errorMessagePath": "error.message",
"errors": [
{
"errorCode": "Code_1",
"errorMessage": "Message 1."
}
]
},
"retryPolicy": {
"fastRetryAttempts": 5,
"fastRetryDelay": 10,
"slowRetryAttempts": 23,
"slowRetryDelay": 60
},
"disableRetry": false,
"emitError": false,
"leaseLockName": "lock-name",
"disablePolling": false
}
The properties of an Outbound Proxy API Store Response Binary stage are the same as those of the Outbound Proxy API Store Response stage, including:
| Property | Description |
|---|---|
httpParametersMode | Either none (default), parameter, or REST. See Outbound API Parameter Options. |
authentication | Optional section defining how authentication to the remote API destination is performed, if required. See Outbound API Authentication Options. |
retryOn4xx | An optional object to inspect HTTP 4xx error payloads, and retry under defined conditions. See Outbound API Retry on HTTP 4xx Errors for more details. |
retryPolicy | Optional object defining a custom retry policy. By default, an initial fast retry (with 5 attempts, 10 minutes apart) is followed by a slow retry (23 attempts, 60 minutes apart). Retry attempt values can be set to 0 to disable the fast and/or slow retry steps, if desired. |
emitError | Optional boolean flag (true or false). Default is false. When true, the stage will capture and emit a payload if a non-retryable error is detected, or if a retryable error is detected on the final retry attempt. See the Emit Error Payload section below for more details. |
disablePolling | Optional boolean flag (true or false). Default is false. When true, the stage does not attempt to poll the "location" URL (if found) when an HTTP 202 response is returned. See Handling HTTP 202 Responses. |
Output Payload Format
The payload output by the stage has the same format that is expected as the input to the Outbound Blob Binary, Outbound SFTP Binary, and Outbound SharePoint Binary stages:
{
"filename": "file-name.pdf",
"base64": "JVBERi0xLjQK..."
}
| Property | Description |
|---|---|
filename | The file name taken from the filename value of the Content-Disposition header returned by the remote API. If the remote API does not return a Content-Disposition header containing a file name, this will be an empty string. |
base64 | A Base64 encoded string of the response body returned by the remote API. |
When the remote API does not supply a file name, the filename value in the output payload will be empty. A downstream stage that requires a file name will need the name to be supplied another way, for example by transforming the payload with a Transform JavaScript or Transform Liquid stage.
Emit Error Payload
In the event that the emitError option has been set to true and:
- a non-retryable error is detected when calling the external API; or
- a retryable error is detected on the final retry attempt
then the stage will emit a payload in the following format:
{
"errorCode": xxx,
"errorPayload": {
// ERROR PAYLOAD FROM REMOTE API HERE
}
}
The event used to emit the payload will be the full stage name with -error appended, e.g. out-proxy-api-store-response-binary-stage-name-error.
Last updated on