Changing JSON from API

Dear Bubblers! I hope this time I’ll again get at awesome answers!

I have a GET request set up in API Connector that returns me a list of things in JSON that are available for the user.
The user could delete some of them by pressing the “DELETE” button.

Could you help me, please, how could I delete the one thing from repeating group as the button is clicked? Please, pay attention that information in the repeating group is received from the external API.

Best,
Dima

Hi @zifiry,

so if I understand correctly you’re not saving the value to the DB at any moment, you’re just using the API connector?

If that’s correct you could probably use custom state/hidden group to track the deleted items or their position in the list and filter the repeating group by this information (remember that performance-wise, all of this would happen client-side).

Hey Alan ,

Thanks for reaching out. Yeah, you are right. I am not saving anything to the Bubble DB, I am just getting data from the API connector.

I am not sure that I got your point but I’ll try. Thank you!

Hi @zifiry , check first if the api has a endpoint for delete. Because if it is just temporal removal, then that means the item would return on every refresh. Can you elborate on whether it is a temporal delete that wants to be carried out, or one from the api side or the data has to be saved on the database as some point in time?

+1, Exactly

@iwakinomotoye @alanpieczonka
As I press the “DELETE” button, I sent a POST request to change the status of the deleted card in the endpoint. It means that on the next request I will get elements that are not hidden.

What I do now: I’ve put an empty data source in my repeating group.
image

Then, as the DELETE button is clicked, I do the following:

  1. Send a POST request to change the status of the item to “deleted” (disputeStatus = 4).

  2. Display list in the repeating group to the data obtained from API but filtered. If disputeStatus is less or equal 3, then we show.

Unfortunately, it doesn’t work. The repeating group doesn’t update as I click the DELETE button. Forum says that RG should update automatically.

Well, I am bit stuck now :grimacing:

@zifiry
I’m not 100% if this will apply here but Bubble doesn’t re-make the API call if the input parameters are all the same since it assumes the output results will also be the same. The thing that often works is adding some sort of a fake parameter and then changing/incrementing it every time you want to refresh the data, which will force Bubble to re-make the call.

There is two thing, when a POST request is sent, does the response come with the same list (this time updated) of what you got when you initially called a GET request? If no is your answer. Then you need to call a GET request again, after the POST request has returned a response. Then it is the response from that GET request that ypu would use to repopulate the repeating group.