# Web API not pulling correct data from Open Weather Map

**URL:** <https://community.thunkable.com/t/web-api-not-pulling-correct-data-from-open-weather-map/116807>\
**Category:** Questions about Thunkable X\
**Created:** [June 22, 2019, 4:54pm UTC](https://community.thunkable.com/t/web-api-not-pulling-correct-data-from-open-weather-map/116807 "2019-06-22T16:54:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sysads](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/sysads/32/44975_2.png) [@sysads](https://community.thunkable.com/u/sysads)\
**Post date:** [June 22, 2019, 4:54pm UTC](https://community.thunkable.com/t/web-api-not-pulling-correct-data-from-open-weather-map/116807/1 "2019-06-22T16:54:46Z")

</div>

I have a weather app am working on and so far able to collect certain data correctly but unable to pull the exact name tag.

At the bottom of the json file, when I try to get the “name” tag, it comes up as “Earth” instead of “Green Wood”

```
	"timezone": 3600,
	"id": 7302135,
	"name": "Green Wood",
	"cod": 200
}
```

---

<div class="post-metadata">

**Author:** ![sysads](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/sysads/32/44975_2.png) [@sysads](https://community.thunkable.com/u/sysads)\
**Post date:** [June 22, 2019, 6:16pm UTC](https://community.thunkable.com/t/web-api-not-pulling-correct-data-from-open-weather-map/116807/2 "2019-06-22T18:16:37Z")

</div>

OK found the issue but a strange one. When I get my current location, the latitude and longitude values are up to 7 decimal places. Using these vales for unknown reason does not read that tag correctly but when I hardcode the values displayed from openweathermap json file which are rounded up to 2 decimal places, then it displays “Green Wood”

---

<div class="post-metadata">

**Author:** ![sysads](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/sysads/32/44975_2.png) [@sysads](https://community.thunkable.com/u/sysads)\
**Post date:** [June 22, 2019, 7:04pm UTC](https://community.thunkable.com/t/web-api-not-pulling-correct-data-from-open-weather-map/116807/3 "2019-06-22T19:04:10Z")

</div>

Nah its random, sometimes it shows the name and sometimes it shows Earth ☹

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [June 23, 2019, 9:16am UTC](https://community.thunkable.com/t/web-api-not-pulling-correct-data-from-open-weather-map/116807/4 "2019-06-23T09:16:35Z")

</div>

You received location values ​​that consist of 7 decimal places. Round out up to 2 characters and use it. The result coincided with when you hard code them? If not, then there is an error somewhere.

I can assume the following situation:

There are several fields in your json data with the key “name”. If you get these fields with the help of the “get” list block, then due to a list indexing error, in one case you may get index 2, and in the other 1. Accordingly, each time the data will be different. Or another option - in different cases different json is returned.

---

<div class="post-metadata">

**Author:** ![sysads](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/sysads/32/44975_2.png) [@sysads](https://community.thunkable.com/u/sysads)\
**Post date:** [June 23, 2019, 1:49pm UTC](https://community.thunkable.com/t/web-api-not-pulling-correct-data-from-open-weather-map/116807/5 "2019-06-23T13:49:22Z")

</div>

Hi and thanks for reply. It was actually an error on my part. I placed the addMarker block in wrong place hence reason why it did not work as expected. Now all OK.

---

<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, 12:13pm UTC](https://community.thunkable.com/t/web-api-not-pulling-correct-data-from-open-weather-map/116807/6 "2024-11-08T12:13:18Z")

</div>


