MSN weather API list of conditions?
Asked Answered
M

5

11

Microsoft has a weather API very similar to Google's (which now appears to be completely dead). I've converted one of my applications over to their feed, but I've been unable to find a list of all possible weather conditions.

This is documented fairly well for Google's weather API, but I can't find a list of conditions for the MSN weather API.

FWIW, an example URL to get data back using MSN is:

http://weather.service.msn.com/data.aspx?weadegreetype=F&culture=en-US&weasearchstr=Chicago,IL (service not available anymore (Jan 2016))

Can anyone shed some light on the possible conditions? I need them so that I can convert the condition text to an icon instead.

Marylnmarylou answered 27/8, 2012 at 12:35 Comment(7)
Is google weather api dead for good or is it just temporarily down? I have about 15 iphone apps that use it and now I am bombarded with user frustration and bad reviewsGrondin
So far what I have read google weather api is used by igoogle which isn't slated for death till Nov of 2013.Grondin
@SamBudda Unfortunately it looks as if the Google weather API is dead for good. It is no doubt part of the transition away from iGoogle (which I also used personally). I have a Google Sites widget that doesn't work anymore either as it relied on Google's weather API. Since the API is undocumented I doubt we'll hear an official response from Google. From what I can tell, Microsoft's API is also undocumented so I suppose it could also go away or change without warning.Marylnmarylou
I just wonder how to use this undocumented api to search by latitude and longitude.Inquisitor
@Inquisitor I'm not sure that it can handle lat/lon. I found VERY little info on this API...mostly just the existence of the XML, the rest I had to figure out on my own. Apple (and I'm sure Android as well) makes it super easy to get a city, state, country, etc which I'm passing in the URL to get the proper data. You would need to do something like an IP geocode for desktop apps. I don't have any resources for you on doing that though as I haven't developed for anything other than mobile.Marylnmarylou
@DonavonYelton Do you have a rights/license to use this service? Or will you just switch again when msn kills it? Just curious. - paulPer
@Per I would just switch when/if MSN kills it. There are other options, but I couldn't find anything as good as MSN's offering of the 'hidden' API. It is very similar (and in many ways better) than what Google offered in their 'hidden' API.Marylnmarylou
M
17

I decided to go a slightly different route and figure out conditions based on the icon provided (skycode and skycodeday) from the XML.

Here is a list of what I came up with. Hopefully it will be helpful for others in migrating from Google's weather API:

  • 0, 1 ,2, 3 ,4, 17, 35 - Thunderstorm
  • 5 - Rain/Snow mix
  • 6 - Sleet/Snow mix
  • 7 - Rain/Snow/Sleet mix
  • 8,9 - Icy
  • 10 - Rain/Sleet mix
  • 11 - Light Rain
  • 12 - Rain
  • 13 - Light Snow
  • 14,16,42,43 - Snow
  • 15 - Blizzard
  • 18,40 - Showers
  • 19 - Dust
  • 20 - Fog
  • 21 - Haze
  • 22 - Smoke
  • 23,24 - Windy
  • 25 - Frigid
  • 26 - Cloudy
  • 27,29,33 - Partly Cloudy (night)
  • 28,30,34 - Partly Cloudy
  • 31 - Clear (night)
  • 32 - Clear
  • 36 - Hot
  • 37,38 - Scattered Thunderstorms
  • 39 - Scattered Showers
  • 41 - Scattered Snow Showers
  • 44 - N/A
  • 45 - Scattered Rain Showers (night)
  • 46 - Scattered Snow Showers (night)
  • 47 - Scattered Thunderstorms (night)
Marylnmarylou answered 27/8, 2012 at 18:27 Comment(3)
i also saw this in msn weather api "Showers / Clear"Grondin
@SamBudda for my purposes I made this Scattered Showers. You call it a pencil, I call it a writing utencil. ;-)Marylnmarylou
Also seen Partly Cloudy as Partly Sunny.Casals
P
6

Here's my function, to easily convert your Google API code to MSN API:

function skycode2image ($skycode)
{    

$daynight = "na";

$skycodes = array ( 
0 => 'thunderstorm', 
1 => 'thunderstorm',
2 => 'thunderstorm',
3 => 'thunderstorm',
4 => 'thunderstorm',
5 => 'rain_snow',
6 => 'sleet',
7 => 'rain_snow',
8 => 'icy',
9 => 'icy',  
10 => 'rain_snow', 
11 => 'showers',
12 => 'rain',
13 => 'flurries',
14 => 'snow', 
15 => 'snow', 
16 => 'snow', 
17 => 'thunderstorm',
18 => 'showers',
19 => 'dust',
20 => 'fog',
21 => 'haze',
22 => 'haze',
23 => 'windy',
24 => 'windy',
25 => 'icy',
26 => 'cloudy',
27 => 'mostly_cloudy',
28 => 'mostly_cloudy',
29 => 'partly_cloudy', 
30 => 'partly_cloudy',
31 => 'sunny',
32 => 'sunny',
33 => 'mostly_sunny',
34 => 'mostly_sunny',
35 => 'thunderstorm',
36 => 'hot',
37 => 'chance_of_tstorm',
38 => 'chance_of_tstorm', 
39 => 'chance_of_rain',
40 => 'showers',
41 - 'chance_of_snow',  
42 => 'snow',
43 => 'snow',
44 => 'na',
45 => 'chance_of_rain',
46 => 'chance_of_snow',
47 => 'chance_of_tstorm');

$condition =  $skycodes[$skycode];

if (in_array($skycode,array(27,29,31,33,31,45,46,47))) $daynight = 'night';
if (in_array($skycode,array(28,30,32,34,36,37,38,39,41))) $daynight = 'day';   

return array($condition,$daynight);

}
Porphyria answered 4/9, 2012 at 3:26 Comment(1)
@can you suggest any font-icons where I can get all of there weather-icons?Shamikashamma
V
2

It seems there's lots of misinformation going on whenever Microsoft is in question. I was testing the MSN Weather API today; and it did return; and is returning weather data, hourly.

I made the following [probably non standard] query just now: "http://weather.service.msn.com/data.aspx?weasearchstr=ny,NY&culture=en-US&weadegreetype=C&src=msn"

And it did return exactly what was requested:

<weatherdata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><weather weatherlocationcode="wc:USNY0309" weatherlocationname="New York, NY" url="http://a.msn.com/54/en-US/ct40.782,-73.832?ctsrc=msn" imagerelativeurl="http://blob.weather.microsoft.com/static/weather4/en-us/" degreetype="C" provider="Foreca" attribution="http://www.foreca.com/" attribution2="Foreca" lat="40.782" long="-73.832" timezone="-5" alert="" entityid="10109777" encodedlocationname="New+York%2C+NY"><current temperature="4" skycode="29" skytext="Partly Cloudy" date="2016-02-07" observationtime="18:00:00" observationpoint="New York, NY" feelslike="2" humidity="62" winddisplay="9 km/h East" day="Sunday" shortday="Sun" windspeed="9 km/h" /><forecast low="-3" high="5" skycodeday="31" skytextday="Clear" date="2016-02-06" day="Saturday" shortday="Sat" precip="" /><forecast low="1" high="7" skycodeday="28" skytextday="Mostly Cloudy" date="2016-02-07" day="Sunday" shortday="Sun" precip="10" /><forecast low="-3" high="3" skycodeday="16" skytextday="Snow" date="2016-02-08" day="Monday" shortday="Mon" precip="90" /><forecast low="0" high="1" skycodeday="30" skytextday="Partly Sunny" date="2016-02-09" day="Tuesday" shortday="Tue" precip="90" /><forecast low="-2" high="5" skycodeday="28" skytextday="Mostly Cloudy" date="2016-02-10" day="Wednesday" shortday="Wed" precip="50" /><toolbar timewindow="60" minversion="1.0.1965.0" /></weather><weather weatherlocationcode="wc:USNY0996" weatherlocationname="New York, NY" url="http://a.msn.com/54/en-US/ct40.714,-74.006?ctsrc=msn" imagerelativeurl="http://blob.weather.microsoft.com/static/weather4/en-us/" degreetype="C" provider="Foreca" attribution="http://www.foreca.com/" attribution2="Foreca" lat="40.714" long="-74.006" timezone="-5" alert="" entityid="23164" encodedlocationname="New+York%2C+NY"><current temperature="5" skycode="29" skytext="Partly Cloudy" date="2016-02-07" observationtime="18:00:00" observationpoint="New York, NY" feelslike="4" humidity="58" winddisplay="7 km/h East" day="Sunday" shortday="Sun" windspeed="7 km/h" /><forecast low="-7" high="4" skycodeday="31" skytextday="Clear" date="2016-02-06" day="Saturday" shortday="Sat" precip="" /><forecast low="1" high="7" skycodeday="28" skytextday="Mostly Cloudy" date="2016-02-07" day="Sunday" shortday="Sun" precip="10" /><forecast low="-2" high="3" skycodeday="16" skytextday="Snow" date="2016-02-08" day="Monday" shortday="Mon" precip="80" /><forecast low="-1" high="1" skycodeday="30" skytextday="Partly Sunny" date="2016-02-09" day="Tuesday" shortday="Tue" precip="80" /><forecast low="-3" high="5" skycodeday="30" skytextday="Partly Sunny" date="2016-02-10" day="Wednesday" shortday="Wed" precip="50" /><toolbar timewindow="60" minversion="1.0.1965.0" /></weather></weatherdata>
Vasileior answered 7/2, 2016 at 23:36 Comment(0)
F
1

It's April, 2016, and it looks like Microsoft Weather data is still coming through: Washington state weather data (link is different from that shown in the OP's post--which is now discontinued).

The "wealocations" parameter in the link is different for every weather collection point; e.g., "USWA0367" is for Redmond, Washington. You can get your weather location code from here.

Fetishism answered 3/4, 2016 at 0:24 Comment(0)
E
0

We are writing to notify you that the Microsoft Weather API will no longer be available for download and will be discontinued as of April 15, 2015, meaning it will no longer provide weather data. Accordingly, please remove the Microsoft Weather API from any of your products or apps that currently use it.

Here is a list of external providers who might be able to support your needs if you are interested in obtaining an alternate weather API:

http://api.accuweather.com/ 
http://www.wunderground.com/weather/api/d/pricing.html 
https://developer.forecast.io/

Disclaimer: Microsoft and Microsoft Weather are not affiliated or associated with any of the above companies in any way.

Thank You Microsoft Weather Team

Effluence answered 2/3, 2015 at 19:38 Comment(1)
Was the service continued? I can still call the APIThetisa

© 2022 - 2024 — McMap. All rights reserved.