Forum Academy Marketplace Showcase Pricing Features

Send binary file via API connector

I upload a file to Box.com via an API call using the following setup:

It works fine when I use the file uploader on the page and reference to it’s value. Also the same call works fine in Postman.

But this API call doesn’t work if I trigger it from a workflow and reference the file in the DB. API returns an error code 400 - it seems Bubble API connector doesn’t send file in binary format. Taking into account that the same api call works with the file uploader element, this issue looks really strange. Is it a bug?

There several similar topics on the forum. Did anyone manage to make it work?

Maybe you need to save the file to S3 first and then pass that?

My bad - the issue was related to the downscoped access token. Although the error message was confusing.

All works now - and the API connector sends the binary file to Box API.

Hey @shpak.serhiy

How did you manage to send the binary file via the API connector?

Thanks a lot.

Hi @ryanck ,
here is how the action looks like:

So as I remember files by default are sent via REST API in binary form and in Bubble you just reference the file url. And in the API call check the checkbox “Send file” as you can see in my first post above.

1 Like

FWIW and for more tech oriented audience, binary file transfer over http may utilize the multipart wrappers ( MIME content type ) on both client / server sides OR it may be designed along more default **fetch / POST / default post.body ** formats .

For the former, note that Box api INCLUDES middleware support for the multipart form parser . Note

-F attributes= …
switch in the CURL example in docs at Box(dot)com.

Concerning the latter option above, some portion of existing upload api’s (node /express for example ) forgo support the multipart wrapper, by looking for a simple request.body formatted as a hex-stream which can simply be piped along its way ( either to the local fs OR to another buffer & stream capable service). tech audience may drill down on this option in the accepted answer here

IMO ( bubble newbie note ) there still exists some gap in bubble for handling file xfer ,

  • over binary
  • using efficient protocols / byte formats
  • without MIME multipart mid-ware wrappers and base64 codecs