# OpenWeatherMap Historical API for students return "no data" when given city, country as input

**URL:** https://discourse.nodered.org/t/openweathermap-historical-api-for-students-return-no-data-when-given-city-country-as-input/67851
**Category:** General
**Tags:** node-red-dashboard, weather
**Created:** [17 September 2022 14:16 UTC](https://discourse.nodered.org/t/openweathermap-historical-api-for-students-return-no-data-when-given-city-country-as-input/67851 "2022-09-17T14:16:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![coco\_linton](https://avatars.discourse-cdn.com/v4/letter/c/ccd318/32.png) [@coco\_linton](https://discourse.nodered.org/u/coco_linton)
#### Post date: [17 September 2022 14:16 UTC](https://discourse.nodered.org/t/openweathermap-historical-api-for-students-return-no-data-when-given-city-country-as-input/67851/1 "2022-09-17T14:16:39Z")

</div>

I am trying to get the historical weather data when city and country is given as the input. It returns the value 404000 (invalid location according to the documentation) and the message "no data" even when I copy-paste the example from their site (I deleted my API key)

`http://history.openweathermap.org/data/2.5/history/city?q=London,UK&type=hour&appid={API_KEY}`

However, it works when I give the latitude and longitude of the same location (London, UK) as the input.  
`http://history.openweathermap.org/data/2.5/history/city?lat={{lat}}&lon={{lon}}&type=hour&appid={{appid}}`

I am using the student plan.

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [17 September 2022 14:35 UTC](https://discourse.nodered.org/t/openweathermap-historical-api-for-students-return-no-data-when-given-city-country-as-input/67851/2 "2022-09-17T14:35:09Z")

</div>

Try GB not UK.  
from the api docs

> Parameters  
> `q` required City name, state code and country code divided by comma, use ISO 3166 country codes.

> **[List of ISO 3166 country codes](https://en.m.wikipedia.org/wiki/List_of_ISO_3166_country_codes#UNI2)**
>
> The International Organization for Standardization (ISO) created and maintains the ISO 3166 standard – Codes for the representation of names of countries and their subdivisions. The ISO 3166 standard contains three parts:
> The ISO 3166-1 standard currently comprises 249 countries, 193 of which are sovereign states that are members of the United Nations. Many dependent territories in the ISO 3166-1 standard are also listed as a subdivision of their administering state in the ISO 3166-2 standard....

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [1 October 2022 14:35 UTC](https://discourse.nodered.org/t/openweathermap-historical-api-for-students-return-no-data-when-given-city-country-as-input/67851/3 "2022-10-01T14:35:41Z")

</div>

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