# \[SOLVED \]Web api returning null value

**URL:** https://community.thunkable.com/t/solved-web-api-returning-null-value/1840623
**Category:** Questions about Thunkable X
**Tags:** solved
**Created:** [April 20, 2022, 5:26pm UTC](https://community.thunkable.com/t/solved-web-api-returning-null-value/1840623 "2022-04-20T17:26:31Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![tanishq](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tanishq/32/124339_2.png) [@tanishq](https://community.thunkable.com/u/tanishq)
#### Post date: [April 20, 2022, 5:26pm UTC](https://community.thunkable.com/t/solved-web-api-returning-null-value/1840623/1 "2022-04-20T17:26:31Z")

</div>

Hello,  
This is my first time using `web api component` and i am making an app which gives random quotes  
I am using [goquotes api](https://goquotes-api.herokuapp.com).  
It gives a null value while running it; please help me

---

<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: [April 20, 2022, 5:49pm UTC](https://community.thunkable.com/t/solved-web-api-returning-null-value/1840623/2 "2022-04-20T17:49:11Z")

</div>

You need to provide more information.

Have you setup the `Web API` component with the requirements of your API service?  
Is the API working fine from the browser directly?  
If the API requires special setup, have you tested it with an API client such as `Postman`?

**[Update]**  
I ran a quick test using the API in the browser and I get results.

```auto
{"status":200,"message":"success","count":3,"quotes":[{"text":"Money will buy a pretty good dog, but it won't buy the wag of his tail.","author":"Josh Billings","tag":"money"},{"text":"I am a morning writer I am writing at eight-thirty in longhand and I keep at it until twelve-thirty, when I go for a swim. Then I come back, have lunch, and read in the afternoon until I take my walk for the next day's writing.","author":"Carlos Fuentes","tag":"morning"},{"text":"A gentleman is simply a patient wolf.","author":"Lana Turner","tag":"men"}]}

```

---

<div class="post-metadata">

### Author: ![tanishq](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tanishq/32/124339_2.png) [@tanishq](https://community.thunkable.com/u/tanishq)
#### Post date: [April 21, 2022, 11:23am UTC](https://community.thunkable.com/t/solved-web-api-returning-null-value/1840623/3 "2022-04-21T11:23:17Z")

</div>

> [@muneer](#):
>
> Is the API working fine from the browser directly?

yes it works in the browser very fine

---

<div class="post-metadata">

### Author: ![tanishq](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tanishq/32/124339_2.png) [@tanishq](https://community.thunkable.com/u/tanishq)
#### Post date: [April 21, 2022, 11:25am UTC](https://community.thunkable.com/t/solved-web-api-returning-null-value/1840623/4 "2022-04-21T11:25:18Z")

</div>

> [@muneer](#):
>
> Have you setup the `Web API` component with the requirements of your API service?

Are you talking about the query parameters? if yes; I haven’t  
Because I don’t know form where should we enter the values

---

<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: [April 21, 2022, 11:55am UTC](https://community.thunkable.com/t/solved-web-api-returning-null-value/1840623/5 "2022-04-21T11:55:50Z")

</div>

Can you share an image of the blocks you have for the `Web API`?

---

<div class="post-metadata">

### Author: ![tanishq](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tanishq/32/124339_2.png) [@tanishq](https://community.thunkable.com/u/tanishq)
#### Post date: [April 21, 2022, 12:06pm UTC](https://community.thunkable.com/t/solved-web-api-returning-null-value/1840623/6 "2022-04-21T12:06:12Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/f/4f1deac10075a9b9c22b596670fa12542987e977.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: [April 21, 2022, 12:14pm UTC](https://community.thunkable.com/t/solved-web-api-returning-null-value/1840623/7 "2022-04-21T12:14:14Z")

</div>

Their [GitHub page](https://github.com/amsavarthan/goquotes-api) has the following note:

Note : The api will not work as it was hosted under free tier at Heroku & it has been exhausted due to high traffic. So clone and host your version of API and test them

Then again, it does seem to be working in a browser.

When parsing the JSON response, you need to convert the green response block to an object. So attach the “get object from JSON” block to it.

Also, you’ll need to get the “quotes” property first and then from that result, take a list item from it and get the “text” property.

---

<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: [April 21, 2022, 12:17pm UTC](https://community.thunkable.com/t/solved-web-api-returning-null-value/1840623/8 "2022-04-21T12:17:20Z")

</div>

The green block `response` is not an object, it is a JSON string.

The other thing is the `quotes` object is a **list** so you need something like this to obtain the first quote of the list of quotes

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

Sample output  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/a/2a5332037fd4212405ebb5942b95a88738427efa.png)

To avoid errors, you should first check that there is no errors then proceed with checking the status

---

<div class="post-metadata">

### Author: ![tanishq](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tanishq/32/124339_2.png) [@tanishq](https://community.thunkable.com/u/tanishq)
#### Post date: [April 21, 2022, 12:20pm UTC](https://community.thunkable.com/t/solved-web-api-returning-null-value/1840623/9 "2022-04-21T12:20:57Z")

</div>

thanks, and what will be the api url?

---

<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: [April 21, 2022, 12:22pm UTC](https://community.thunkable.com/t/solved-web-api-returning-null-value/1840623/10 "2022-04-21T12:22:49Z")

</div>

The same as you have in the image you sent.

I used this `https://goquotes-api.herokuapp.com/api/v1/random?count=3`

---

<div class="post-metadata">

### Author: ![tanishq](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tanishq/32/124339_2.png) [@tanishq](https://community.thunkable.com/u/tanishq)
#### Post date: [April 21, 2022, 12:24pm UTC](https://community.thunkable.com/t/solved-web-api-returning-null-value/1840623/11 "2022-04-21T12:24:29Z")

</div>

when I live test it the screen gets white

---

<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: [April 21, 2022, 12:27pm UTC](https://community.thunkable.com/t/solved-web-api-returning-null-value/1840623/12 "2022-04-21T12:27:48Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/2/720241cd9649aa078ef794b57d75059e59df71d1.png)

This is the full code blocks and I pasted a sample output in a previous post and this is another.

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/8/28e80011e1f26e1e0c2ca61ad1205c86c8a94bb4.png)

---

<div class="post-metadata">

### Author: ![tanishq](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tanishq/32/124339_2.png) [@tanishq](https://community.thunkable.com/u/tanishq)
#### Post date: [April 21, 2022, 12:32pm UTC](https://community.thunkable.com/t/solved-web-api-returning-null-value/1840623/13 "2022-04-21T12:32:47Z")

</div>

thanks @muneer and @tatiang I got my mistake

---

<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: [July 20, 2022, 12:32pm UTC](https://community.thunkable.com/t/solved-web-api-returning-null-value/1840623/14 "2022-07-20T12:32:48Z")

</div>

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