Send Multi-part Content
This procedure shows how to create a flow that sends multi-part content.
The connectivity::rest
parameter implicitly treats the request as
multi-part where the content type is multipart/*, and the body is an array of parts.
Full sample
code:
"flows": {
"UploadFileFlow": {
"id": "UploadFileFlow",
"version": "0.1",
"start": "startState",
"specVersion": "0.8",
"functions": [
{
"name": "UploadFileFunction",
"operation": "connectivity::rest",
"type": "custom"
}
],
"states": [
{
"name": "startState",
"type": "operation",
"actions": [
{
"functionRef": {
"refName": "httpOutbound",
"arguments": {
"uri": "${.connectionProperties.baseURL + \"/upload/drive/v2/files\"}",
"method": "POST",
"body": [
{
"Content-Type": "text/plain",
"Content-Disposition": "form-data; name=\"metadata\"",
"Content": "${ .input.FileMetadata }"
},
{
"Content-Type": "${ .input.FileMetadata.mimeType }",
"Content-Disposition": "${ \"form-data; name=\\\"file\\\"\"}",
"Content": "${ .input.File }"
}
]
}
},
"actionDataFilter": {
"results": "${ { body: .body, headers: .headers } }",
"toStateData": "${ .output }"
}
}
],
"end": true
}
]
}
}