Uploading file via backend workflow via API

I have a following case I cannot solve.
I have created a backend workflow that receives an activity and a file.
I have other API calls for workflows work, but what doesn’t work is sending a file.

My Workflow

The Postman responses with 400 Missing data, “Missing parameter for workflow XXXXX: parameter PODs”

And I am giving him a direct file.

Are you calling your endpoint from Postman? I’m pretty sure files should be sent as URLs (not certain of this and can’t test right now). Show us your API call if you want help debugging.

1 Like

Well it’s not a URL so I guess here is the problem. I was trying to pass an actual file.
I will give it to the second part of the team to try to send an URL there.

I tried to send a file as both file/text in Postman → a picuter of a cat from internet:

https://i.natgeofe.com/n/548467d8-c5f1-4551-9f58-6817a8d2c45e/NationalGeographic_2572187_square.jpg

And error is the same.
File sent as text error:

File sent as file error:

Why are you sending PODs? What are PODs? Your workflow takes Files and Activity as parameters.

Yes. One parameter is text Activity (unique id) the other POD is a file .
POD stands from proof of delivery - that’s why it’s called this way.

Okay, but your API call is looking for a Files parameter…
CleanShot 2023-12-07 at 11.43.37@2x

Yup - I tested both things.
So - what is the way I should use to upload a file via backend workfow to bubble?
Do I need a plugin? As the effect I want to have is to have this file in bubble, not just the link to the file.

Did you? Share screenshots. Maybe this will help you… [RELEASED / FREE] File Uploader Bubble API

You need to change your content type to json and send the file url. You can use :saved to s3 to save it in Bubble storage.

That is an error if I am seding a text and expecting a file.
Cause I understand I have just 2 parameters and 4 options
Send : text or file
Receive: text or file
But I need to save it in the Database as a file (in the end), to send it later some other place.

@Jici in which place I can convert it, as when I receive a text/file I do not have this option (in the backend workflow - make changes to a thing action).

Again, show your API call or we can tell what you’re doing.

All right:

Case: Sending an image, expecting a file (type=file)

Case: Sending a link, expecting a file (type=file)

Case: Sending a link, expecting a text (type=text)

Those are the cases I tested.

The answer is here. Your list of files key is called PODs but your Bubble endpoint is looking for a key called Files. Rename your PODs parameter to Files or vice versa.

1 Like

Yeah in the first screenshot I had it differently name, but it has the name that matches - PODs in Postman and Bubble.
Or I have misunderstood you?

image

You’re also sending the API call as form-data when it should be JSON. Change the body to raw → JSON and write out your Activity and PODs parameters there.

2 Likes

Ok, so now it got a bit tougher - As I need to write the whole JSON here - is there a structure which it should follow so bubble can get it?

{
    "Activity": "123456x123456",
    "PODs": "https://..."
}

ChatGPT will write it for you if you export your cURL call from Postman and tell it to rebuild a cURL call with a JSON body.

1 Like

I will try to fight it tomorrow another day :slight_smile: Still not there yet.