# Querying Web API

**URL:** <https://community.thunkable.com/t/querying-web-api/2271095>\
**Category:** Web API's\
**Created:** [February 11, 2023, 1:15am UTC](https://community.thunkable.com/t/querying-web-api/2271095 "2023-02-11T01:15:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nabeela.akram5rbtna](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/nabeela.akram5rbtna/32/141210_2.png) [@nabeela.akram5rbtna](https://community.thunkable.com/u/nabeela.akram5rbtna)\
**Post date:** [February 11, 2023, 1:15am UTC](https://community.thunkable.com/t/querying-web-api/2271095/1 "2023-02-11T01:15:56Z")

</div>

Hi. I need help with this. Do you think you have the solution for this?

API Link: [https://neelpatel05.pythonanywhere.com/](https://neelpatel05.pythonanywhere.com/)  
Thunkable Link: [Thunkable](https://x.thunkable.com/copy/07365cbdf7fe02f65b90f79c7c5a9355)  
There are 119 periodic elements. I want it to work something like when hydrogen is click in 2nd screen it will display info related to it in 3rd screen (INFO SCREEN) by fetching it from API.

---

<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:** [February 11, 2023, 2:44am UTC](https://community.thunkable.com/t/querying-web-api/2271095/3 "2023-02-11T02:44:43Z")

</div>

What is and is not working in your project?

I don’t even see hydrogen on the screen so I’m not sure how you would test this.

When I paste your API url response into [https://codebeautify.org/jsonviewer](https://codebeautify.org/jsonviewer), I can see that the “symbol” property is at array–\>0–\>symbol which in Thunkable would be the property “1.symbol” of the array object. So you would want to check if that symbol is equal to the one clicked (“H”).

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/d/edf02b087768988920f7c316e301395f2a951259.png)

---

<div class="post-metadata">

**Author:** ![manyone](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@manyone](https://community.thunkable.com/u/manyone)\
**Post date:** [February 11, 2023, 4:22am UTC](https://community.thunkable.com/t/querying-web-api/2271095/4 "2023-02-11T04:22:28Z")

</div>

if you go with what your are contemplating you will end up with 119 screens!  
what you need is one screen and one way (or 2 ways) to put the information to the screen.

1. one way is to let the user enter the atomic number, eg. 1, and after you click the button, it will show the screen will show the information for hydrogen…
2. another way is to let the user enter the name of the element, “He” , and it should bring up the Helium.

i see you have the full periodic table as a table in json format. it means you can access them selectively by array posiition. ie. array location 1 points to Hydrogen, location 2 points to Helium, location 3 to Lithium, etc.so it is easiest to access any element by array location .

if you want your user to use atomic number , you’ll need to build a table of atomic numbers. similarly you willl need a separate table of element names… if you can find the element in one of these tables, its location number can be used to index into the json table so you get all the information related to the element directly.

so put together some blocks and try it yourself and if you get stuck show us your blocks and someone will try to help you.

---

<div class="post-metadata">

**Author:** ![nabeela.akram5rbtna](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/nabeela.akram5rbtna/32/141210_2.png) [@nabeela.akram5rbtna](https://community.thunkable.com/u/nabeela.akram5rbtna)\
**Post date:** [February 11, 2023, 9:05am UTC](https://community.thunkable.com/t/querying-web-api/2271095/5 "2023-02-11T09:05:10Z")

</div>

Hi Manyone Thanks for your response. If you look at the design in screen 1 it contains invisible buttons upon each element. When clicked on let’s say hydrogen it takes us to next screen wherein it will fetch information from API and display.

---

<div class="post-metadata">

**Author:** ![nabeela.akram5rbtna](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/nabeela.akram5rbtna/32/141210_2.png) [@nabeela.akram5rbtna](https://community.thunkable.com/u/nabeela.akram5rbtna)\
**Post date:** [February 11, 2023, 9:09am UTC](https://community.thunkable.com/t/querying-web-api/2271095/6 "2023-02-11T09:09:42Z")

</div>

![Screenshot 2023-02-11 143820](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/7/97c680daa60696f5a0dbcaaef6e32356eab74cc8.jpeg)

---

<div class="post-metadata">

**Author:** ![manyone](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@manyone](https://community.thunkable.com/u/manyone)\
**Post date:** [February 11, 2023, 10:16am UTC](https://community.thunkable.com/t/querying-web-api/2271095/7 "2023-02-11T10:16:01Z")

</div>

you’re missing out on one of the best features in thunkable - any component block - or what i started calling as “indexible buttons” (or components).  
please read this tutorial to give you an idea if this process would work for you.

> [@Create Smarter Designs with the "Any Component" blocks](https://community.thunkable.com/t/create-smarter-designs-with-the-any-component-blocks/297263):
>
> Here are three different layouts with lots of buttons: Conventional wisdom would have you believe that creating something like the designs below would be a time consuming and challenging process. If you wanted 9, 16 or 25 buttons then you’ll spend a lot of time messing around with rows and columns and sizes and paddings…right? Wrong! All 3 of the designs shown above are created from just 1 button, 1 row and 1 column. By using the [Any Component](https://docs.thunkable.com/any-component-blocks) blocks you can create a…

the outcome is you end up with a table of buttons that are numbered button1 to buttonP (where P is total rows times total columns). you will need an internal table ot translate that button1 is for the location of H in the json table, that buttons 2 thru 17 are not used but button18 points to the location of He in the json table.  
when any button is pressed, you get a number that can be translated to an index, and the index can be used to get the element info from json table.

but the way you’ve started coding it, you will end up with coding 119(!) When\_Buttonxx\_Clicked blocks!  
i dont know enough thunkable internals - the way you chose may be faster because each button is directly related to a when\_clicked block.

if you still want to ability to successive displays of element in sequence, you stilll need the internal table i described above so if you know that button 39 was pressed, you know that the next button will be button 40. you wont need to check if button-sulfur is followed by button-chlorine.  
this is just my observation - you may receive other suggestions from other thunkable users. good luck.

---

<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:37pm UTC](https://community.thunkable.com/t/querying-web-api/2271095/8 "2024-11-08T13:37:05Z")

</div>


