Skip to content

Instantly share code, notes, and snippets.

@karlstolley
Last active September 7, 2018 16:43
Show Gist options
  • Save karlstolley/99b733313a9a13782843 to your computer and use it in GitHub Desktop.
Save karlstolley/99b733313a9a13782843 to your computer and use it in GitHub Desktop.
openweathermap.org API responses
// http://api.openweathermap.org/data/2.5/forecast/daily?q=Fake%20Town,%20AZ&units=imperial&cnt=5&callback=forecast
// (Call for 'Fake Town, AZ' -- there is of course no such town)
{
"message": "",
"cod": "404"
}
// http://api.openweathermap.org/data/2.5/weather?q=Phoenix,%20AZ&units=imperial&callback=weather
weather(
{
"coord":
{
"lon": -112.08,
"lat": 33.45
},
"sys":
{
"message": 0.338,
"country": "United States of America",
"sunrise": 1400156840,
"sunset": 1400206919
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "Sky is Clear",
"icon": "01d"
}],
"base": "cmc stations",
"main":
{
"temp": 74.53,
"temp_min": 74.53,
"temp_max": 74.53,
"pressure": 978.87,
"sea_level": 1033.54,
"grnd_level": 978.87,
"humidity": 20
},
"wind":
{
"speed": 4.47,
"deg": 71.5002
},
"clouds":
{
"all": 0
},
"dt": 1400167430,
"id": 5308655,
"name": "Phoenix",
"cod": 200
});
// http://api.openweathermap.org/data/2.5/forecast/daily?q=Phoenix,%20AZ&units=imperial&cnt=5&callback=forecast
forecast(
{
"cod": "200",
"message": 5.7294,
"city":
{
"id": "5308655",
"name": "Phoenix",
"coord":
{
"lon": -112.076,
"lat": 33.4483
},
"country": "United States of America",
"population": 0
},
"cnt": 5,
"list": [
{
"dt": 1400180400,
"temp":
{
"day": 84.52,
"min": 61.47,
"max": 90.99,
"night": 63.59,
"eve": 90.99,
"morn": 61.47
},
"pressure": 973.23,
"humidity": 20,
"weather": [
{
"id": 800,
"main": "Clear",
"description": "sky is clear",
"icon": "01d"
}],
"speed": 13.59,
"deg": 88,
"clouds": 0
},
{
"dt": 1400266800,
"temp":
{
"day": 90.86,
"min": 57.38,
"max": 96.3,
"night": 65.75,
"eve": 95.2,
"morn": 57.38
},
"pressure": 969.17,
"humidity": 23,
"weather": [
{
"id": 800,
"main": "Clear",
"description": "sky is clear",
"icon": "01d"
}],
"speed": 4.34,
"deg": 147,
"clouds": 0
},
{
"dt": 1400353200,
"temp":
{
"day": 91.83,
"min": 58.41,
"max": 96.49,
"night": 67.82,
"eve": 95.86,
"morn": 58.41
},
"pressure": 965.98,
"humidity": 22,
"weather": [
{
"id": 800,
"main": "Clear",
"description": "sky is clear",
"icon": "01d"
}],
"speed": 4.69,
"deg": 184,
"clouds": 0
},
{
"dt": 1400439600,
"temp":
{
"day": 90.79,
"min": 56.52,
"max": 95.32,
"night": 67.8,
"eve": 94.5,
"morn": 56.52
},
"pressure": 964.74,
"humidity": 20,
"weather": [
{
"id": 800,
"main": "Clear",
"description": "sky is clear",
"icon": "01d"
}],
"speed": 7.37,
"deg": 196,
"clouds": 0
},
{
"dt": 1400526000,
"temp":
{
"day": 87.93,
"min": 57.36,
"max": 90.9,
"night": 71.46,
"eve": 90.9,
"morn": 57.36
},
"pressure": 955.96,
"humidity": 0,
"weather": [
{
"id": 800,
"main": "Clear",
"description": "sky is clear",
"icon": "01d"
}],
"speed": 9.87,
"deg": 192,
"clouds": 10
}]
});
Simpflied (and incomplete) weather codes for mapping to icons:
200s: Thunderstorms
300s: Light Rain
500s: Rain
600s: Snow
700s: Fog/smoke/haze
800,950-956: Clear
801,802,803: Some clouds
804: Overcast
Extreme weather codes:
957+: Severe winds/storms
781,900: Tornado
901: Tropical Storm
902: Hurricane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment