Best way to manage API data

Hello.

I’m pretty much new to APIs, especially regarding Thunk.

I’d like to ask about the best way to store (JSON) data.

I have a series of lists. At the moment an API call is made when a user clicks an item on the list. Then that new JSON is filtered and replaces the existing list. Constantly calling the API seems like a bad way to do things and I would like some advice on doing one big API call on app start.

What is the best way to store a bunch of API calls, or is there a way to filter the JSON IN Thunkable as at the moment I can get Properties and Objects, but not filter them before I extract the objects to a list, nor after.

I’ve tried to do a big API call at the start and store each API response as a variable. But I then can’t call the data later and insert it into a list as is shown below.

For example, when I use this:


which does return a correct list (ignore the “do something”), I’m not sure how to filter it at the point while it is still JSON, or after it becomes a list in storedEventsList. I would guess that I would do it after.

At the moment I change the API URL and do a new API call for each time the list is changed. Which obviously isn’t ideal…

Thanks :slight_smile:,

Eric.

I’ve actually found my own answer, which is always nice :slight_smile:

I started by using a TEST inside the list (after insert last as), but this would leave me with empty list items because they would still be created.

By using a IF before the list, I can still filter the JSON, but then only add list items IF they meet the aforementioned condition, which in this case is a specific stage. But could be used to match any property.

I can then store that data in a var and populate the single list view when needed, without having to do lots of API calls :smiley: :+1: