Sending Binary Data through API Connector

So I have seen this question pop up a bunch but no definitive answers (or at least ones that worked for me).

I’m trying to send an image thumbnail to Vimeo following this guide: Vimeo

I get stuck at step 3:

In postman, this is easy, as I can just set the request to binary and choose the file I want to upload. However, I am not sure how to pass that binary data or how to even format it to begin with in the API Connector plugin.

I set the body type to raw, and then passed the image file encoded in base64 (using the bubble encoded in base64 file operation), using the headers:
Content-Type: image/jpeg
Accept: application/vnd.vimeo.*+json;version=3.4.

This results in a failure 400 bad request.

My question, is it even possible to send this binary data using the API connector? I’m thinking not as it is, and a quick search doesn’t show me any plugins that could allow this. So I’m thinking I have to find another way of getting that binary data through.

What would be the best way to accomplish this? This is a trivial thing that for my app is only needed for this one thing (to upload a thumbnail), so I am trying to avoid overcomplicating the process, lol.

@davidavellan I may be missing something but assuming you’re converting the image into binary data and sending that file in the Bubble API Connector you should be good?

That’s the part where you need a plugin or something.

@redvivi Might of had a solution I think?

I have never been able to get it working but I didn’t really need it, more was just experimenting.

Maybe “Read to Base 64” followed by a “Bytes from Base 64” action would work?

Thanks for the tip. Unfortunately, that didn’t work. I had to choose a really small image to make it not timeout, (12kB gif), and was able to get it to output a list of numbers. I can format the list of numbers as a text, but that doesn’t work either. It’s a list of numbers from 0-255. I would guess binary data would mean a list of 0’s and 1’s, but I’m not sure how to pass that.

So I’m not sure if there is a way of formatting a string into a value that will be accepted as binary data into a raw body, or if the body type has to be set as binary (which we can’t do in the API connector).

I’m wondering if there would be a way if running a cURL request using javascript or going about this in another fashion.

If anyone stumbles across this thread, I ended up making a private plugin for @davidavellan that directly makes the API call with the binary data in a server-side action.

We found the API connector was modifying the binary data somehow before it was getting sent out.

DM me w/ your app name if you need the plugin :slightly_smiling_face:

6 Likes

Thank you Tyler! Works like a charm :grinning:

Hey, my friend!

I’m having this same issue, would be able to send me that plugin? i would reaaaally appreciate it, I’ve tried and everything and I can’t get it working.

thank you

Hello,
Same here, trying to upload a picture on Sharepoint using the Graph API, but content need to be binary data… Can you help me or give access to the plugin ?

Many thanks !

Hello, @tylerboodman! Do you mind sending me the plugin? It would be of great help, my friend. I really need to send binary data to set up an API Call for uploading videos to Dropbox

This might do this trick: FileToBinary by GhostCodes Plugin | Bubble

If not lmk and I’ll try to rework it. Otherwise I’m sure @tylerboodman will get back to you guys.

Or does it need to be the other way around? If so I can add that functionality I’m sure.

1 Like

Hi, @GH5T! Thank you so much for the plugin. I was able to make the API Call initialize and run on a workflow, but the video file im uploading to dropbox is being uploaded corrupted. Im not sure what’s happening in the conversion to binary, but I know something wrong is going on because the file size being shown on Dropbox is not equal the file size on my computer

1 Like

How big is your file?

not large, 3 mb.

Hi, Tyler
Same issues here.
Please, could you send me the plugin?

App - https://template-dualpixel.bubbleapps.io/

Thanks a lot!

Sure, I direct messaged you guys :slightly_smiling_face:

Hi friends, have made an update on my current plugin.

Here is a link for you to get the latest File To Binary plugin from BubbleAppolis and also includes a demo to show how it all works.

Enjoy!

1 Like

Hello there,

Thanks for sharing these insights mate as I found it very much useful and informative.

Hey Tyler,

I’m one of those guys who stumbled upon this. Do you think this will work for converting videos into binary? I’m setting up the Bunny.net API for video streaming and stuck on the binary upload. Could you please send me that plugin?

Thanks man!

My plugin has been updated. Maybe try that out? If not then I’m sure Tyler has your back.

Thanks for reaching out! I’m in the demo and tried with an MP4 file and this is the error I’m getting.

Any thoughts if video binary is going to be a problem?