# How to change screen when a web API updated

**URL:** <https://community.thunkable.com/t/how-to-change-screen-when-a-web-api-updated/1806134>\
**Category:** Questions about Thunkable X\
**Tags:** solved, beginner\
**Created:** [March 28, 2022, 2:29pm UTC](https://community.thunkable.com/t/how-to-change-screen-when-a-web-api-updated/1806134 "2022-03-28T14:29:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![skyline24121995blg](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@skyline24121995blg](https://community.thunkable.com/u/skyline24121995blg)\
**Post date:** [March 28, 2022, 2:29pm UTC](https://community.thunkable.com/t/how-to-change-screen-when-a-web-api-updated/1806134/1 "2022-03-28T14:29:19Z")

</div>

Hi,

I would like to know if it’s possible to switch to the second screen that right after a Web API field in Thingspeak is updated. If can please show me how.

The purpose of this feature is to create a push notification when the thingspeak API updated. As i am currently using the free version of thunkable, I am currently unable to use the push notification feature. Thank you.

---

<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:** [March 28, 2022, 2:44pm UTC](https://community.thunkable.com/t/how-to-change-screen-when-a-web-api-updated/1806134/2 "2022-03-28T14:44:58Z")

</div>

You would need to:

1. Get the API response from the server
2. Parse the response and get the property (“field”) value
3. Check the value to see if it’s different from last time you checked
4. Navigate to another screen

Which of those do you have working and which do you need help with?

---

<div class="post-metadata">

**Author:** ![skyline24121995blg](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@skyline24121995blg](https://community.thunkable.com/u/skyline24121995blg)\
**Post date:** [March 28, 2022, 2:50pm UTC](https://community.thunkable.com/t/how-to-change-screen-when-a-web-api-updated/1806134/3 "2022-03-28T14:50:06Z")

</div>

Honestly, I do not know where to start, will it be alright if you show me how to start from the very beginning? thank you.

---

<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:** [March 28, 2022, 3:01pm UTC](https://community.thunkable.com/t/how-to-change-screen-when-a-web-api-updated/1806134/4 "2022-03-28T15:01:35Z")

</div>

Here’s a tutorial and video I made that explains how to use an API in Thunkable:

> [@API JSON Tutorial (Video)](https://community.thunkable.com/t/api-json-tutorial-video/1140575):
>
> Using APIs in Thunkable and understanding how to parse JSON to get certain data from the API response is both a popular and a difficult aspect of using Thunkable. It’s not so much difficult because of Thunkable but because every API url format is different, every API documentation is different, every JSON response is different, etc. In this video, I spend a lot of time talking you through some best practices. It’s not a quick tutorial because if you rush through setting up an API in Thunkable, …

---

<div class="post-metadata">

**Author:** ![skyline24121995blg](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@skyline24121995blg](https://community.thunkable.com/u/skyline24121995blg)\
**Post date:** [March 28, 2022, 3:46pm UTC](https://community.thunkable.com/t/how-to-change-screen-when-a-web-api-updated/1806134/5 "2022-03-28T15:46:43Z")

</div>

1. I am currently using Thingspeak Web API
2. [Sign In - ThingSpeak IoT](https://api.thingspeak.com/channels/)\<myAPI\_id\> /fields/\<5\>/last.json
3. {“created\_at”:“2022-03-28T15:37:07Z”,“entry\_id”:55,“field5”:“0”}
4. I am not too sure whats the value are
5. 

![Capture](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/9/3974fba4fcccd06a25a51a179529001568125ca5.png)

 ![Capture2](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/8/f81fc21c7db57f997ba5bb58469cc702432af07c.png)

I am a bit loss as how to make thunkable read the field content, and how to make it navigate to screen 2 if the field content is 1 without having to press any button.

---

<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:** [March 28, 2022, 5:15pm UTC](https://community.thunkable.com/t/how-to-change-screen-when-a-web-api-updated/1806134/6 "2022-03-28T17:15:11Z")

</div>

The API response from that URL is:

` {"created_at":"2022-03-28T15:37:07Z","entry_id":55,"field5":"0"}`

If you paste that into [Best JSON Viewer and JSON Beautifier Online](https://codebeautify.org/jsonviewer), you can see it in a more readable format:

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/8/08201635110b8f2d943e753a55e7614c27d7a060.png)

If you follow my tutorial, you’ll see that you can get the “entry\_id” property from the JSON object/response using blocks in Thunkable. It looks like you’ve tried to do that.

Where you have “1” you need to put the green `response` block. Because the `get object from JSON` block is expecting a JSON response to be attached. Personally, I would assign that `get property of object` block to a variable first (although you don’t have to; it’s just cleaner code in my opinion) and then after that, check if the variable equals 1.

---

<div class="post-metadata">

**Author:** ![skyline24121995blg](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@skyline24121995blg](https://community.thunkable.com/u/skyline24121995blg)\
**Post date:** [March 29, 2022, 3:21am UTC](https://community.thunkable.com/t/how-to-change-screen-when-a-web-api-updated/1806134/7 "2022-03-29T03:21:34Z")

</div>

Thank you so much for your help!  
I finally get it to work. your video and explanation really make it work for me!  
This is the current block code that successfully works for me. Although I am still unsure how to make so that the code trigger only if the thingspeak API was updated. But nonetheless, this should be sufficient for now. Thank you!  
 ![Capture3](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/6/d65134e6b18e461d8ae4bbdc293f505ef16077b9.png)

---

<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:** [March 29, 2022, 3:35am UTC](https://community.thunkable.com/t/how-to-change-screen-when-a-web-api-updated/1806134/8 "2022-03-29T03:35:07Z")

</div>

You’re welcome!

The only way I know to make sure it changes screen when the field5 property is equal to 1 is to put all of those blocks that are in the `when UPDATE Click` block into a loop instead. You just need to be careful about calling APIs too many times because most APIs have a daily limit or other limit. So you could make this check every minute or every ten minutes, depending on what your app does.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [June 27, 2022, 3:36am UTC](https://community.thunkable.com/t/how-to-change-screen-when-a-web-api-updated/1806134/9 "2022-06-27T03:36:05Z")

</div>

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