Uploading Files in Actions
Here is everything you need to know to configure action so that they can upload files.
Last updated
Was this helpful?
Here is everything you need to know to configure action so that they can upload files.
Last updated
Was this helpful?
In order to upload files through an action, either a public URL or a URL that is available in a Flow (e.g. the output of the ) needs to be referenced to in a field with the key request_binary_url
, which can be configured like this in the :
If that key is set and a valid URL is passed to it, the file will be converted to binary format and sent with the header value "Content-Type": "multipart/form-data"
.
The body consists of
name
which is by default file
,
filename
which is based on the file name in the URL or if that cannot be retrieved file
,
Content-Type
which is based on the file itself, and
the file itself in binary format
and looks like this (without the file):
If the endpoint expects the file to be uploaded in that way, both the Request Body and Header Template need to be configured with {}
only.
These parameters will then have the filename
parameter, equal to the name of the Parameter. In case that is not desired or accepted by the API, the header should be set to:
The following file meta data can be used in the body or header by referencing to binary_file.
name
content
mime_type
Content-Type
headerTo use a different Content-Type
than the standard multipart/form-data
, the Request Body Template needs to be left empty and the Content-Type that should be used needs to be set in the Request Header Template.
form_item_name
upload
Some Connectors expect files as base64 strings. In order to upload files like this, the upload parameter needs to be used.
So the Action setup would look something like this:
You can also upload a file using REST Helper.
Specify the API URL:
Determine the appropriate API endpoint you want to interact with.
Set Authorization Header:
Optional, if required by the API
Select Content Type:
If you want to upload a file, you should select
multipart/form-data
Set empty Body
{}
File to Upload
{{ some_pdf }}
In addition to the automatically set body key-value pair, additional ones can be sent (which is e.g. required by ), by adding the parameters to the body like regular parameters. These will then be sent as form-data
as well.
For an example usage, .
If the Request Header Template is left empty, no Content-Type
header will be sent.
This is e.g. needed for (and other Microsoft file upload endpoints.
Some APIs, such as require that the name
in the body is set to something else than the default file
, in that case image
. This can be configured directly in the UI Form Schema, by specifying the parameter form_item_name
with the name
that should be sent, e.g.:
This parameter can be set to false
if the file should not actually be uploaded, but only be converted to binary format and then uploaded in another format. This is for example needed to , where the request body needs to be built in the request body template and then base64 encoded: