[SOLVED] How to POST a file via API

Hi,

I am using a document conversion service that takes PDFs and outputs JSON.

I have it working in Postman.

The thing is, Postman has a “Choose files” button that allows me to upload the file I want to test. I attach the file, complete the parameters, and boom - it’s all good.

However, in Bubble I don’t know how to get the API to post an actual file. I’m just talking about the initial API connector/setup - not workflows or anything like that.

Is there a way to do this?

Thanks,
P

I suspect you will have to upload the file to S3 and then use that URL in the initial API call.

1 Like

Hi Nigel,

I think the issue is that the S3 url is a url and not a file. This means I can use an API that deals with urls - which, for test purposes, have done with some success. However, the service I need to use does not work with urls, it works with files. So this method of using S3 url does not work with my target service.

The API documentation (for the service I want) reads “In your bash, navigate to the folder where you downloaded the pdf file, and then issue… the POST method”. Doesn’t this imply that the file exists in a folder location/path rather than a url? Perhaps I’m being silly – maybe these could amount to the same thing. But if not then it seems what I need is a folder (perhaps on a hosting server)? I’m not clear on a folder location like this gets a url address or whether it is something different… but if different it would explain why I can’t get the API to work.

Thoughts?

@emmanuel , could use your weigh-in on this…

Thank you!
P

If the API takes a URL, great, otherwise we don’t support this.

Great - thank you. Won’t waste my time with this API then.

Cheers,
P

Is it possible to send a file via API Connector (image or video) from a user’s computer without having to upload the file to Bubble’s File Manager?

I’m sending the file to Publit.io.