WebAPI response in a batch process issues

I’m trying to recover data from an API that returns data from Brands and Car Models, to populate a Firebase Database.

I have an specific table in Firebase with the brands and for each record in this table I need to read data of the models from the API in a batch process.

So, I put the API call inside a for each J block (testing if the response is empty), but Thunkable jumps the API responses and don’t save any data.

I already faced sync problems on loops, that I solved inserting waiting blocks, but never with API reading, so this time I have no success.

Below the simplified version of blocks that are doing this process (I cut some parts to facilitate the understanding of the issue, because in fact I have another loop in the GET method to process the response, but in example below I just save the entire response) :

Captura de tela de 2022-05-04 13-00-02

If you want to check, the API URL is:


The “/3/” in the URL is the information that will change in the loop, according the Firebase Table (a list with almost 200 records) and corresponds to the Car Manufactor ID (3 = Alfa Romeo). This API returns the car models of the brand that are available in Brazil.

Any ideas how to load this data?


Paulo Vaz

1 Like

This is a known programmatic issue in nearly all languages. It is very difficult to use Asynchronous function inside a loop specially when that function has other commands that takes time.

The solution is divide and conquer.

Instead of one loop use two loops.

  • The first loop is to read the API and store information in list or object
  • The second loop stores the information collected by the first in Firebase.

See this demo to show the example of unexpected behavior from the loop.

1 Like

I made some changes in my blocks to reflect this approach (in fact I tried something like this before). So now, I store the API response in a List, and create a List Viewer just to check the results. See below:

Captura de tela de 2022-05-04 14-18-10

With this, the data from API is fully loaded in the list!
The problem now is that I need to save J value with the list item, but the value is not stored correctly. Look the result in the list viewer (many repetitions of J, with different API responses):

Without the correct J assignment in the list, I can’t save in Firebase to know from witch car brand that models belongs to and save the API response.

Any idea how to solve this?

1 Like

This is the solution for such cases

This is not the only solution but a clear way of how to avoid this situation.

1 Like

It was a little be tricky, I changed all the approach to load the data to avoid this erratic behavior (2 days working in this issue), just because the processing is asynchronous…

In these moments I see that the “NO CODE Development” is just a elegant way to say “we try to make your live easier, but you need to be a programmer, a lazy one, but a programmer” :stuck_out_tongue:

But now looks okay. Thanks master @muneer !

1 Like

I say nocode is a lie when you want to create complex custom workflows like we can with Thunkable.

Some things can be nocode, but we can really get into the area of lowcode in situations like this. It takes some CS knowledge or the help of others to pull this off!

Great work guys! @muneer @manyone


Yes, I agree with your sentiment about No Code. What I like about Thunkable is that while I still need to know how to program – the logic, the organization, the math, the troubleshooting – my success doesn’t depend on me knowing the exact syntax for every command or the more sophisticated programming structures that underly the blocks I’m using.

So if I’m taking a photo or searching for a certain word in a list of items, I know how to use that block/feature in my application but I’m not stuck trying to write the 5 or 15 or 50 lines of code that would be required to make that happen. I don’t think it really hinders my abilities to not know what’s going on behind the scenes most of the time and Thunkable allows me to quickly and confidently just do what I need with one or a few blocks and move on to other things.


I hope you all understood correctly my comment about Thunkable being a no-code development tool (in specific situations like this).

For visual or simple workflows like said @jared, I’m absolutely sure that it is a no-code tool, but when we are dealing with complex projects, with many business rules, data loading, integrations with external APIs, it would certainly be very naive to assume that Thunkable would be codeless. This understanding I have since the day I started using the tool.

Anyway, I agree with you that even for the most complex things, the tool becomes “low coding”, as the use of the concept of blocks makes things much easier.

But the reason for my comment was that some situations go beyond knowing logic, math, or how to program; it’s not just about knowing what a block is for or how to organize the implementation. These are not so obvious things, because are related to functional characteristics of the product’s architecture that determine whether an implementation strategy/approach will work or not.

Unfortunately these situations are not exposed in the official tutorials or in the good documentation available, which forces us to learn in pain.

Things like that IMHO should be in advanced tutorials with implementation techniques, or provided in practical examples to avoid wasting time trying to find out the reason for these erratic behaviors while debugging the application. There are a lot of videos but most are just very basic stuff.

Looking through the questions here on the community forum, we found examples of questions like this one, which are only solved when someone who has been through the “pain” knows how to solve it and comes up with a recipe on how to do it. And luckily the community is very active and fast, but it’s time that could be saved if there were more advanced documentation.

I’m working on a single project, which is an ecosystem of multiple apps made with Thunkable, it’s been 7 months, time spent, partly because of my lack of experience with the tool, partly because of the complexity of the project and partly because I left coding in the last 25 years moving to IT management. Thats the reason I chose Thunkable :slight_smile:

But fortunately I’m close to reaching the launch point. And because it’s a big project, the need for advanced resources is mandatory, and periodically I’m “stuck” in situations like this, and figuring out how NOT to do things, which delays the delivery, but I’m very grateful for the attention and help I receive from your side!


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.