# For each item j and web API problem

**URL:** <https://community.thunkable.com/t/for-each-item-j-and-web-api-problem/1481804>\
**Category:** Questions about Thunkable X\
**Tags:** list, webapi\
**Created:** [September 1, 2021, 3:28pm UTC](https://community.thunkable.com/t/for-each-item-j-and-web-api-problem/1481804 "2021-09-01T15:28:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [September 1, 2021, 3:28pm UTC](https://community.thunkable.com/t/for-each-item-j-and-web-api-problem/1481804/1 "2021-09-01T15:28:16Z")

</div>

Does Web API not work the same in a for each item j?

I’m expecting the results to be 30, 31, and 91 but it always either  
30, 30, 30  
31, 31, 31  
or  
91, 91, 91

Here’s a screenshot of the blocks & a link to the project  
[https://x.thunkable.com/copy/b7703fe040675a26eca28bbf9883b999](https://x.thunkable.com/copy/b7703fe040675a26eca28bbf9883b999)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/6/26a095c3cfacf6e8622261f31bfff39760e905e2.png)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [September 1, 2021, 4:48pm UTC](https://community.thunkable.com/t/for-each-item-j-and-web-api-problem/1481804/2 "2021-09-01T16:48:15Z")

</div>

The `Web API Get` is an **asynchronous** block which means it will allow the next block to be processed before if completes its work.

Move the `in list ....... insert at last as ........` inside the `Get` block so that data is only added once the process is completed.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 1, 2021, 6:51pm UTC](https://community.thunkable.com/t/for-each-item-j-and-web-api-problem/1481804/3 "2021-09-01T18:51:28Z")

</div>

@muneer is right. Think of it this way:

You’re telling Thunkable: “Get info from a server (API). Add a variable’s value to a list.” Thunkable is going to begin the API call and then immediately add the “empty list” value of that variable to the list. An API call can take several seconds to complete. So to insure that you are adding the correct value to the list, you need to – as @muneer suggested – move that “in list” block inside the “then do” section which _only_ runs after the API call is processed.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 1:16pm UTC](https://community.thunkable.com/t/for-each-item-j-and-web-api-problem/1481804/4 "2024-11-08T13:16:59Z")

</div>


