Outbound Form Data Stage
The Outbound Form Data stage allows a single file to be uploaded to a remote API using multipart/form-data.
Stage Overview
The Outbound Form Data stage allows a single file to be uploaded to a remote API using multipart/form-data.
Stage Definition File Location
All Outbound Form Data stages are defined by creating an appropriately formatted JSON definition file in the following location:
The Outbound Form Data stage uses the same directory structure/location as the Outbound Proxy API stage definition, but the contentType value of form-data forces the deployment of an Outbound Form Data stage, rather than an Outbound Proxy API stage.
Stage JSON Definition File Format
The JSON definition file for an Outbound Form Data 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": "form-data",
"externalApiBaseUrl": "$env:BASE_URL",
"externalApiUrlPath": "$env:API_PATH",
"httpMethod": "POST",
"header": {
// Custom headers
},
"httpParametersMode": "none",
"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,
"emitEvent": "previous-stage-name-1",
"emitError": false,
"emitErrorTerminateSuccess": false,
"leaseLockName": "lock-name"
}
| 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. POST and PUT 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. |
emitEvent | When the call to the remote API is successful, the stage will normally terminate. However, under certain circumstances, it may be desirable to continue workflow processing. The optional emitEvent flag allows the payload of a previously run stage to be output as a message from this stage. The stage must have previously been executed in the run history of the overall Integration Hub integration, with the stage's exported payload details being present in the Cloud Event Attributes section. |
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. |
emitErrorTerminateSuccess | Optional boolean flag (true or false). Default is false. When true, and when emitError is also true, the stage will terminate with a Successful state, rather than a Failed state, in the event of an error being detected and emitted.When the stage is configured to operate in this way, the integration should be defined so that a subsequent stage, or series of stages, will be triggered by the emitted error payload to "handle" the error condition in such a way that reporting and alerting on the error (as would happen if the stage terminated with a Failed state) is unnecessary. |
leaseLockName | Optional. See Lease Locking. |
Required Payload Format
This stage must be triggered with a payload in the following format:
{
"$content-type": "multipart/form-data;boundary=formDataBoundary",
"$multipart": [
{
"body": {
"$content-type": "application/zip",
"$content": "{{content.fileBase64String}}"
},
"headers": {
"Content-Disposition": "form-data;name=file;filename={{filename}}"
}
},
{
"body": "{{content.command}}",
"headers": {
"Content-Disposition": "form-data;name=command"
}
}
]
}
Successful Output Payload
{
"filename": "1681354154109.zip",
"base64": "{{base64Content}}"
}
The output of the out-form-data stage matches the expected input payload format for the out-blob-binary stage. This is intentional, and allows the Outbound Form Data stage to download file content from external services and immediately trigger an Outbound Blob Binary stage to upload the content to Azure Blob Storage.
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-form-data-stage-name1-stage-name2-error.
Last updated on