File Uploads with Call URL Actions

In Call URL actions, you can use <%=[File Attachment Column]%> placeholder to refer to a file’s content. This extension opens the possibility to integrate with a wide range of cloud storage, document conversion, and e-signature services.

The actual code we generate depends on a request body format.

File Uploads with Text-Based Body Formats

For text-based body formats (XML, JSON, Text), we encode the file’s content as base64 string. This is the most common way to inject non-text data into a larger, otherwise text-based document, JSON structure for example.

Some, but not all APIs that use this encoding are Microsoft Graph API (Mail), SendGrid, and [DocuSign](https://

developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/). To fully describe the file, in addition to the file’s data, these services may require two more parameters: the file’s name and the file’s media type. To help deal with these, we added two functions: FileName([attachment]) and FileType([attachment]). Both are available only in Call URL action’s body formula context.

Below is a sample setup for Microsoft Graph API - the action sends an email to the email address specified in [To], using [Subject] and [Message] and optionally attaches the file if specified in [File] column.

Sample Setup for Microsoft Graph API

Please note the use of the conditional expression <%?not IsNull([File]%>. In the absence of the file <%=[File]%> construct would generate null, which will likely lead to an API error. With a conditional expression, we can omit the whole "attachments" section when there is no file.

Also, "name," "contentType," and "contentBytes" keys in the attachment descriptor are in no way standard across the APIs. SendGrid API, for example, names these keys as "filename," "type," and "content," respectively.

File Uploads with Form Body Format

Form body format sends the data just as a browser does. In its simple form, the payload is a list of key=value pairs separated by the & sign. But this way of encoding is limited to text-only data. But once files appear in the payload, things are going far more complicated. We’ll save you from all the technical details; simply add key=<%=[File Attachment Column]%> and we’ll do the rest properly. Box.com API uses form file uploads.

New File Body Format

File body format is new. When selected, we send the content of the file as a request payload. This opens the road for upload integration with multiple cloud storage services, including but not limited to Google Drive, OneDrive, and DropBox.

With File body format, the formula accepts sole <%=[File Attachment Column]%> and nothing else.

We’ve prepared a sample database that demonstrates file upload capabilities to four cloud storage providers: Google Drive, OneDrive, Dropbox, and Box.com — feel free to explore.