This is the technical documentation for the MSN Weather API.
Prerequisites
Get assigned ocid + apikey for API access
API Spec
The REST APIs return response with JSON format. We have 2 APIs for different usage:
1. Weather current API. This API provides basic current weather information, e.g. current conditions, temperature.
2. Weather overview API. This API provides current weather, 5-day forecast, 8-hour forecast, almanac, weather alert, etc.
These APIs share the same request parameters and response behavior except request path.
How to make an API call:
https://api.msn.com/{path}?ocid={ocid}&apiKey={apiKey}&lat={latitude}&lon={longitude}&units={units}&locale={locale}
Response data schema when status code = 200
Fields in API response:
alerts: a list of weather alerts, sorted by alert significance. The first one is the highest alert significance. For example, for locale=ja-jp:
units: A set of localized temperature/pressure/speed/length unit string for Imperial/Metric system. For example, for locale=ja-jp, units=F vs units=C
current: current weather condition, for example, locale=ja-jp&units=F:
forecast.days: 5 days (today, tomorrow, Day3, Day4, Day5) forecast information. For every day, there are data points for the full 24-hour day, day/night weather, and almanac information.
forecast.days[x].hourly Next 8 hours forecast
baro: trim to integer, forecast hourly barometric/atmospheric pressure.
cap: localized string for condition (sunny, partly cloudy, rainy, etc)
dewPt: trim to integer, dewpoint
feels: trim to integer, A synthetic value that estimates what the temperature "feels like," rather than the actual observed temperature.
rh: trim to integer, Humidity percentage 0-100%
icon: icon code to represent current condition, 1-100
temp: trim to integer, current temperature
precip: the hourly precipitation possibility
uv: trim to integer, UV value
vis: trim to integer, visibility distance
windSpd: wind speed
windDir: 0-360 degree
valid: target hourly time
forecast.days[x].daily day/night and daily overall weather
forecast.days[x].daily.day: weather condition for day time
forecast.days[x].daily.night: weather condition for night time
forecast.days[x].daily.{day/night} cap/icon/precip/windDir/windSpd/summary: same as previous definitions
windMax: maximum wind speed
windMaxDir: direction (0-360 degrees) of maximum wind speed
rhHi: High humidity
rhLo: Low humidity
tempHi: High temperature
tempLo: Low temperature
icon/precip/uv/uvDesc: same as previous definitions
forecast.days[x].almanac sunrise/sunset/moon information
sunrise: sunrise time
sunset: sunset time
moonrise: moonrise time
moonset: moonset time
moonPhase: localized moon phase state
moonPhaseCode: enumeration for 8 phase code
valid: target day
source: location information, for example:
id: internal data id
timezoneName: Olson Time zone name for the given location
countryCode: Alpha-2 code for the given location https://en.wikipedia.org/wiki/ISO_3166-1
Appendix
1. Weather response alert significance. It has 4 levels from most severe to mild
R: Red, O: Orange, Y: Yellow, B: Blue
2. Weather response alert class.
3. Moon phase code list Lunar phase - Wikipedia