Getting file into Bubble using API connector

Hi Everyone,

I am hoping someone can help me, i am trying to test something really simple, and i am banging my head against a brick wall. The simple use case is that i want to get a file into bubble using an API. I am just trying to test getting a PDF, or any document in. I have set up my API connector like this

But whenever i initialise, i get this error

this is my very basic workflow

If i turn on that it can be optional, it will of course run.

But there is never anything saved in my database

I know i am uploading a valid document in the API connector, because i can see it in file manager

image

I just cannot get it to work. Can anyone help???

Thanks so much.

Rob

Use “Detect data” in the parameter definition and it should work.

Also run the first API call in initialize mode.

Change ‘form-data’ to JSON and you’ll be good to go. No need for any initialisation.

Thanks i think i will need to then convert to base 64 after? Not sure if you are free to help on a paid basis, but i have a few issues i need dealing with in my app. Drop me an email if you are interested rob.shropshire@origin-eng.co.uk

Thanks i think i will need to then convert to base 64 after? Not sure if you are free to help on a paid basis, but i have a few issues i need dealing with in my app. Drop me an email if you are interested rob.shropshire@origin-eng.co.uk

no need to convert to base64 after

the api connector is able to read files being sent

Are you trying to save the pdf to the database and display on the front end?

No need to initalize the call actually

What usecase are you trying to do by the way,

You can also send any file to the api connector by changing it from json to formdata

hah if you let the api workflow detect the data being sent you won’t have those specific parameter issues and it will go straight to the file manager but well…

Did you figure this out? I’m on this same mission and struggling as well. I have a file in a database object that I need to rename and then attach to another database object. I can get the download done easily enough through the API connector, but the upload through a BEWF similar to yours is not working for me.

Thanks all for your help. I was actually using the API connector as a way just to test a file coming into the database, and being able to store the file correctly, as a PDF. That being said, the ‘thing’ that was triggering the creation of the workflow was a script (this was tied to a button whereby the script would then generate a PDF, the challenge was getting bubble to be able to get the PDF that was generated from the script. Using JSON did help so thanks.

Hi David,

In the end, as the file was being generated from the front end using a JS (toolbox) i ended up using a workflow to send the base64 content to a backend workflow, and here via parameters i was able to then link it where i wanted to in Bubble. The JS payload was setup to send BASE64 straight to the backend workflow, where there, Bubble could interpret it as a file automatically, and then i just needed to link to the other data types i wanted to. There may be a much simpler solution depending on your use case though, the reason mine is so difficult is being there is a fair bit of Javascript, which is allowing some features like pagination, drag and drop template design, and merging from database using absolute positioning, obviously moving away from standard Bubble then causes additional complexities.