Outbound Proxy API Store Response Stage
The Outbound Proxy API Store Response stage allows a remote API to be called and its response output as a new message.
Stage Overview
The Outbound Proxy API Store Response stage allows a remote API service to be called from Integration Hub, and for the remote API call response to be output as a message in Integration Hub for further processing in the integration.
For calling a remote API that returns a binary response (e.g. a PDF or an image), see the Outbound Proxy API Store Response Binary stage.
As of Integration Hub v5.0.0, using the Outbound Proxy API stage is preferred, as that stage's emitEvent flag allows the Outbound Proxy API stage to emit the remote API service's response as a payload in the same way that this stage does, but with a more concise stage name.
Updating integrations to remove the use of this stage is encouraged, as this stage will be deprecated in the future.
Stage Definition File Location
All Outbound Proxy API Store Response 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 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,
"contentType": "json",
"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."
},
{
"errorCode": "Code_2",
},
{
"errorMessage": "Message 2."
}
]
},
"retryPolicy": {
"fastRetryAttempts": 5,
"fastRetryDelay": 10,
"slowRetryAttempts": 23,
"slowRetryDelay": 60
},
"disableRetry": false,
"emitError": false,
"leaseLockName": "lock-name",
"disablePolling": false
}
| Property | Description |
|---|---|
name | The API part of the stage name. See API Interface stage names. |
operation | The Operation part of the stage name. See API Interface stage names. |
displayName | Optional (but highly recommended). A short (3 or 4 word) "display name" for the stage, used as a "title" of the stage in the Integration Hub Portal service's self-documentation capability. |
description | Optional (but highly recommended). A brief (10 to 15 word) description of the stage, used as a brief description of the stage's purpose in the Integration Hub Portal service's self-documentation capability. For a more detailed explanation (when needed), use the stage markdown feature. |
enabled | Optional boolean flag (true or false). Default is true. Generally set via a DevOps variable. Controls if the stage is deployed enabled or not. |
source | The source event that the stage subscribes to. See Pub/Sub Model. Alternatively, sources may be supplied, and an array of one or more source events can be subscribed to. |
concurrency | Optional number of concurrent runs permitted for the stage. Default is 10. |
externalApiBaseUrl | The base URL of the remote API destination. |
externalApiUrlPath | The path of the remote API destination. (Appended to the externalApiBaseUrl.) |
httpMethod | The HTTP method used when calling the remote API destination. GET, POST, PUT, PATCH, and DELETE are supported. |
header | An optional object of key-value pairs, which will be included in the headers when the remote API is called. |
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. |
additionalRetryHttpCodes | An optional array of additional retry HTTP codes. By default, the stage will automatically retry the remote API call in the event of a standard "transient error" HTTP response code being received. (See also the retryPolicy section below.) However, if required, additional HTTP response codes can be defined, and if these response codes are received from the remote API, these will also trigger a retry of the remote API call. This is useful when remote APIs do not respect standard HTTP response codes. |
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. |
disableRetry | Optional boolean flag (true or false). Default is false. When true, the stage does not attempt to retry calls to the remote API if a retryable error is detected. |
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 below for more info. |
leaseLockName | Optional. See Lease Locking. |
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 the section below on handling HTTP 202 responses. |
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-stage-name1-stage-name2-error.
Handling HTTP 202 Responses
In the event that the API being called by the Outbound Proxy API Store Response stage returns an HTTP 202 response code and the response also includes a "location" header, then the stage will automatically call the URL defined by the "location" header value.
If the "location" URL responds with an HTTP 202 response and the response also includes a "location" header, then the process will be repeated.
However, if the "location" URL responds in any other way (e.g. with an HTTP 200 or an HTTP 5xx response code), then this is the result that the stage will complete with.
This process allows the Outbound Proxy API Store Response stage to call APIs that accept a request and require "background processing", and to then "poll" the required URL until background processing has been completed and the results are available.
The process will poll the "location" URL up to 49 times, with a 5 second delay between the calls. This means that the background processing will need to complete within around 4 minutes for this process to work. If this is insufficient for the background processing task being called, use the disablePolling feature to disable automatic polling, and handle the process manually in the integration design.
Last updated on