How to update uploaded file

Hi everyone i’m a new bubbler and i need help with apis.

I have a structured json file of the costumer registry of one of my client. This file is an exportation of an ERP. Every day this file is updated.

I upload this file with the front end file uploader, I copy the url and put it inside the api connector with the GET function and everything is working great. Bubble can read the file and can give me all the data that i need.

Now my problem is how can i update this file every day and be sure that the api connection work?
This file is on a local ftp server for know, i think i can use some service like integromat to automatically send it to bubble, but i don’t know how to update the previous file.

Thank you so much for you help

This is a great question and one who’s answer I believe is

It’s impossible to update a file so that it retains the same url but has new content

That said, I want to believe there actually is a way to update a file in place. If we could, that would unlock several advanced capabilities in Bubble (alas, not being able to upsert files has plugin-blocked me many times) @vini_brito , @keith , @jonah.deleseleuc @gaurav , do any of you know if this is possible in Bubble?

We rely on Bubble’s middleman API to the S3 storage, and they only provide us with a POST (insert) endpoint. One remedy is to use an external storage.
Now, depending on the use case, we can return files from publicly exposed workflows now that they support GET.

2 Likes

I don’t know if that’s possible directly. But you could create some sort of redirect or short-link that always points to the most recent version of the file in question (e.g., using Rebrandly or similar).

1 Like

@keith, @vini darn :frowning:

Yeah, redirects are the way except they don’t work well in the context of distributable plugins. Thanks for confirming the thing that makes me sad today, lol :upside_down_face:

1 Like

Well Rebrandly (and other such things) does have an API, so you could get the user’s keys and whatnot in the plugin and use them in your code. It’s not particularly elegant, but it could be done. (Obvs it would be better to just have file upserting as you say, @zelus_pudding.)

Like others have noted, doesn’t seem like you can update a file. However, it seems feasible to do the following:

When it’s the time to update the file, GET the file information and use that to generate a new file, then POST the new file (using a unique name, ex: file-currentdatetime)

Then, delete the file named: file-yesterday’s-date

Et voila. Less intuitive, but at least it works