Refresh RG displaying GET API Call after successful POST API Call to same data source

thank you - yes, that also worked

I cleared list and the displayed list and it was nice and smooth

Thank you!

Cheers

Frank

2 Likes

Yeah, the goal was to put a changing piece of data so that every time it was requests bubble things the api call was different. When you added the “is empty” to the end of the generator it was always false, so the value actually never changed even though the random number did.

@david17 @frankstillone @Jici

I am just starting to play around with APIs and have things setup to test this approach and feel as if I must be doing something wrong.

When I use the approach from @david17 to have a Date parameter in the header and subsequently follow the workflow actions to display data in the RG with the header set to ‘current date/time’ the refresh of my RG works, but only once.

When I use the approach from @jici to clear the list and then to display the list again, this also works, but only once.

I then tried to use the random number in a header, and that doesn’t work at all.

In the first two approaches that work, but only once, if after I run the workflows for the second time and do a page refresh the new data appears.

Is there something that I am missing to make the RG refresh every time or is it something that actually only works once?

I tried to add a one second pause between the action to create data in the API and displaying the data in the RG using the GET call, but that didn’t help.

Through all the testing I only ever once saw the RG data get refreshed twice (ie: workflow ran twice without a page refresh) but it failed to do it a 3rd time and every other test remained with only 1 instance of the RG data getting updated.

1 Like

Can you share your setting when it refresh once?

If I focus on just the current date and time in the Header method


And then if I use the clear list and display list method

Screen Shot 2021-03-29 at 7.01.11 PM

Did you test using step by step to check what happen?

Yes…In step by step mode it runs through the steps correctly, but it still only has the RG updated once.

If you can make your app in public view mode and share your editor link, maybe we can have a look and try to find why it’s not working. For me both way work correctly.
did you check also for API Limitations? (# of calls you can do each seconds for example).

The API is just set up between two of my bubble apps as I am just trying to get a grasp on how APIs work generally, so unless Bubble puts some API limitation by default, I don’t believe there would be any reason a limitation would cause it to not update unless there are settings in the app for this.

Here is a link to the editor

On preview mode would need username and password which are username and password

Here is screen shot from the preview page.

The create Via API button is what will trigger the creation and the updating of the RG

First the ‘Input SSN’ will need some number then press encrypt button…once it is in encrypted (second input will display it) then can press the create Via API button.

The RG above the grey container has the API Get response results and the count above it SSN API is the count of the results, which in screen shot shows 14.

1 Like

Cannot access preview mode because you have set a password on it. If you an remove it just for a moment, it would be easier to test

Yes, the username is username and password is password

For the bottom with create action, I see no problem. Everything work fine.
For you Delete action. It doesn’t work actually. It delete the item, but you have nothing in process to refresh the RG. And if you delete an item, and add a new one, it may create an issue.
don’t forget also that RG may need some scrolling to show more results. But tested adding 10 items and RG was updated correctly. If you delete one and add a new one right after, you may not see the newer item, but this is just because you didn’t have a WF to refresh RG after delete action

That is strange that it is working for you. It still doesn’t work for me.

For testing this approach to refreshing the RG and updating the results from the API call, I was only setting it up and focusing it on the creation process. The delete button is not set up to refresh the API call.

When running and only focusing on the create Via API which has the refresh setup on it, I still don’t see it working properly.

I have a count at the top of the RG as well as a cell index number in the cell to double check this…and although most times the RG is refreshed, it doesn’t return all the results properly.

The video below demonstrates what I am experiencing. Any ideas why it wouldn’t be working properly?

In the video I start with 6 results from the API…the first creation and refresh works fine. The second has a lag before it updates the count…after that there are 3 more creation and refresh attempts that do not update the results. It is not until I refresh the page that the final 3 creations are in the results bringing total count to 11.

Can you remove the clear list step just before the display one?
Have tested and it doesn’t always work. But if you do Step by Step, it work. I can see two things A) the call is too fast between create and get, and the item from get doesn’t show. But… normally if you create another one, The previous created one should show. It doesn’t happen.
Yesterday I didn’t get any issue. Tested created 10 in a row without problem.

Okay…my original suspicion was that there is a timing issue…I had inserted a 1 second pause before, which didn’t do anything, so the timing issue may be greater than that.

I’ll do some more testing with removing the clear list step and see if that improves things.

Thanks for the help.

1 Like

Solution for me: In the work flow, use the ‘Do every 5 seconds’ option to run the GET for the list. Run every 1 seconds instead of 5. Display the data in the group where you have your list. The list pulls data from the parent group.

The previous solutions worked only the first time data is changed. This works infinite times.

1 Like

For anyone still curious how this is done, I was able to get my data to refresh every time, and not just once.

Rather than just having “Current date & time” I had to do “Current date & time” formatted as UNIX. (I believe this is because it will give different results every time)

3 Likes

Cheers Jared - thanks for the update!

I’ve been needing this info and here it is

Can I get a better explanation please.

  • I have two APIs, one to Post and one to Get
  • When a workflow is triggered to Post the data with the header containing today’s date.
  • What happens after?

Nvm, I figured it out. You have to add “fake” header to both Get and Post calls