- Previous: WeatherBug REST XML API
- Up: Introduction
- Next: Google GEO API Example
WeatherBug REST JSON API
*Note: This page is best viewed in Firefox.
API Key
When formatting a request, the API Key that was sent to you in the email with the Subject “Your WeatherBug REST XML key” should be substituted for the value “xxxxxx” in all of the sample requests provided here.
***NOTE: To use the API's below, you need to register for an API key from this "developer.weatherbug.com" web site.
Icons
The icons used to display forecast sky conditions can be either transparent or opaque and are resizable.
The URL format is: http://img.weather.weatherbug.com/forecast/icons/localized/<height>x<width>/en/trans/cond###.png
Where:
- cond### is the image number associated with the forecast condition (this is returned in the forecast response)
- <height> is a number between 15 and 500 in increments of 5
- <width> is a ratio ( (42 / 50 X height) rounded) used to keep the image dimensions from being distorted
The smallest values for <height> x <width> shall be 15 x 13, while the largest values shall be 500 x 420.
Example for transparent icon image: http://img.weather.weatherbug.com/forecast/icons/localized/500x420/en/trans/cond000.png
NOTE: You can access the opaque versions of these icons using the above URL path structure and changing the “trans” parameter to “opaq”.
Passing the Data as a Script (Wrapping the Return)
Passing the data as a script (wrapping the return) is a JSONP, or "JSON with padding", function. You are able to wrap any returns with a value (function call) by adding the Function parameter and specifying the value (f=<value>). This changes the return to a script with the function call wrapped around it.
Alerts Call with Function Parameter:
http://i.wxbug.net/REST/Direct/GetAlert.ashx?zip=97202&api_key=xxxxxx&f=wrap the return
Return with Wrap:
wrap the return({"alertCount":0,"alertList":[],"supportsAlerts":true});
Return without Wrap:
{"alertCount":0,"alertList":[],"supportsAlerts":true}
Hourly Forecast (US Only)
Returns forecast information for all available hours (7-day forecast period) for a given US Zip Code or the Latitude/Longitude of a US location. The hourly values for the current day will only display the next full hour through to the end of the day and the nighttime hourly values may not be available for the 7th day. You must specify which hourly data types (ht) to return (see options below). If no hourly data type is specified, no values will be returned.
- ht= hourly data types
- Follow this pattern: GetForecastHourly.ashx?ht=i&ht=d&ht=t
- Possible values are:
- Icon= “i” (see Icons section at top of page)
- Description= “d”
- Temperature= “t”
- Sky Cover= “sc”
- Chance of Precipitation= “cp”
- Feels Like= “fl”
- Wind Direction= “wd”
- Wind Speed= “ws”
- Dew Point= “dp”
- Humidity= “h”
Call By Zip Code Format:
http://i.wxbug.net/REST/Direct/GetForecastHourly.ashx?zip=21044&ht=t&ht=i& ht=d&api_key=xxxxxx
- zip = any US Zip Code, 5 character numeric string
Returns:
{"forecastHourlyList":[{"chancePrecip":null,"dateTime":1282122000000,"desc":
"Thunderstorms","dewPoint":null,"feelsLike":null,"feelsLikeLabel":null,"humidity":null,
"icon":"cond006","skyCover":null,"temperature":73,"windDir":null,"windSpeed":null},
.
.
.
{"chancePrecip":null,"dateTime":1282680000000,"desc":"Partly Cloudy","dewPoint":null,
"feelsLike":null,"feelsLikeLabel":null,"humidity":null,"icon":"cond002","skyCover":null,
"temperature":76,"windDir":null,"windSpeed":null}],"temperatureUnits":"°F",
"windUnits":"mph"}
Call By Latitude/Longitude Format:
http://i.wxbug.net/REST/Direct/GetForecastHourly.ashx?la=34.3156& lo=-81.1089&ht=t&ht=i&ht=d&api_key=xxxxxx
- la= latitude
- North is positive, South is negative
- double: -90 <= la <= 90
- lo= longitude
- East is positive, West is negative
- double: -180 <= lo <= 180
Returns:
{"forecastHourlyList":[{"chancePrecip":null,"dateTime":1282122000000,"desc":
"Mostly Cloudy","dewPoint":null,"feelsLike":null,"feelsLikeLabel":null,
"humidity":null,"icon":"cond024","skyCover":null,"temperature":81,"windDir":null,
"windSpeed":null},
.
.
.
{"chancePrecip":null,"dateTime":1282680000000,"desc":"Partly Cloudy","dewPoint":null,
"feelsLike":null,"feelsLikeLabel":null,"humidity":null,"icon":"cond003","skyCover":null,
"temperature":83,"windDir":null,"windSpeed":null}],"temperatureUnits":"°F",
"windUnits":"mph"}
7-Day Forecast
Returns forecast information for a given US Zip Code, City Code or Latitude/Longitude of a location. You must specify how many days (nf), if you want hourly details returned (ih) and which data types (ht) to return (see options below). If no data type is specified, no values will be returned.
- nf= number of days to return for forecast (Enter 1 for 1 day, 2 for 2 days, etc. You may return up to 7 days.)
- ih= entering "ih=1" allows you to include hourly forecast details, which will break the forecast down by each hour for each day (Hourly details are only available for US locations. If you don't specify "ih", the returned forecast will only include the daily summary. The hourly values for the current day will only display the next full hour through to the end of the day and the nighttime hourly values may not be available for the 7th day.)
- c= culture support, options are c=(US, GB, FR, CA, DE, IT, ES, BR, ZN, TW, JP)
- l= language string, options are l=(en, fr, de, it, es, pt, zh, ja, ko, da, cs, nl, fi, nb, sv)
- ht= hourly data types, possible values are:
- Icon= “i” (see Icons section at top of page)
- Description= “d”
- Temperature= “t”
- Sky Cover= “sc”
- Chance of Precipitation= “cp”
- Feels Like= “fl”
- Wind Direction= “wd”
- Wind Speed= “ws”
- Dew Point= “dp”
- Humidity= “h”
Call By Zip Code Format (include hourly details):
http://i.wxbug.net/REST/Direct/GetForecast.ashx?zip=21044&nf=1&ih=1&ht=t&ht=i &l=en&c=US&api_key=xxxxxx
- zip = any US Zip Code, 5 character numeric string
Returns:
{"forecastList":[{"dateTime":1287705600000,"dayDesc":"Sunny","dayIcon":"cond007",
"dayPred":"Sunny. Highs in the upper 50s. Northwest winds around 15 mph with
gusts up to 25 mph.","dayTitle":"Friday","hasDay":true,"hasNight":true,"high":
"60","hourly":[{"chancePrecip":null,"dateTime":1287763200000,"desc":"Partly
Cloudy","dewPoint":null,"feelsLike":null,"feelsLikeLabel":null,"humidity":null,
"icon":"cond003","skyCover":null,"temperature":58,"windDir":null,"windSpeed":
null},{"chancePrecip":null,"dateTime":1287766800000,"desc":"Partly Cloudy",
"dewPoint":null,"feelsLike":null,"feelsLikeLabel":null,"humidity":null,"icon":
"cond003","skyCover":null,"temperature":57,"windDir":null,"windSpeed":
null},{"chancePrecip":null,"dateTime":1287770400000,"desc":"Partly Cloudy",
"dewPoint":null,"feelsLike":null,"feelsLikeLabel":null,"humidity":null,"icon":
"cond003","skyCover":null,"temperature":54,"windDir":null,"windSpeed":null},
{"chancePrecip":null,"dateTime":1287774000000,"desc":"Partly Cloudy","dewPoint":
null,"feelsLike":null,"feelsLikeLabel":null,"humidity":null,"icon":"cond002",
"skyCover":null,"temperature":51,"windDir":null,"windSpeed":null},
{"chancePrecip":null,"dateTime":1287777600000,"desc":"Mostly Clear","dewPoint":
null,"feelsLike":null,"feelsLikeLabel":null,"humidity":null,"icon":"cond070",
"skyCover":null,"temperature":48,"windDir":null,"windSpeed":null},
{"chancePrecip":null,"dateTime":1287781200000,"desc":"Mostly Clear","dewPoint":
null,"feelsLike":null,"feelsLikeLabel":null,"humidity":null,"icon":"cond070",
"skyCover":null,"temperature":47,"windDir":null,"windSpeed":null},
{"chancePrecip":null,"dateTime":1287784800000,"desc":"Mostly Clear","dewPoint":
null,"feelsLike":null,"feelsLikeLabel":null,"humidity":null,"icon":"cond070",
"skyCover":null,"temperature":45,"windDir":null,"windSpeed":null},
{"chancePrecip":null,"dateTime":1287788400000,"desc":"Clear","dewPoint":null,
"feelsLike":null,"feelsLikeLabel":null,"humidity":null,"icon":"cond031","skyCover":
null,"temperature":44,"windDir":null,"windSpeed":null}],"low":"36","nightDesc":
"Mostly Clear","nightIcon":"cond070","nightPred":"Mostly clear. Patchy frost after
midnight. Lows in the upper 30s. West winds 5 to 10 mph.","nightTitle":"Friday
Night","title":"Friday"}],"temperatureUnits":"°F"}
Call By Latitude/Longitude Format (forecast for the entire day only):
http://i.wxbug.net/REST/Direct/GetForecast.ashx?la=34.3156&lo=-81.1089&nf=1&ht=t& ht=i&l=en&c=US&api_key=xxxxxx
- la= latitude
- North is positive, South is negative
- double: -90 <= la <= 90
- lo= longitude
- East is positive, West is negative
- double: -180 <= lo <= 180
Returns:
{"forecastList":[{"dateTime":1287705600000,"dayDesc":"Sunny","dayIcon":"cond007",
"dayPred":"Sunny. Highs in the mid 70s. Northeast winds 5 to 10 mph.","dayTitle":
"Friday","hasDay":true,"hasNight":true,"high":"74","hourly":null,"low":"43",
"nightDesc":"Clear","nightIcon":"cond031","nightPred":"Clear. Lows in the lower 40s.
East winds around 5 mph.","nightTitle":"Friday Night","title":"Friday"}],
"temperatureUnits":"°F"}
Call By City Code Format (forecast for the entire day only):
http://i.wxbug.net/REST/Direct/GetForecast.ashx?city=54835&nf=1&ht=t&ht=i&l=en&c=US &api_key=xxxxxx
- city = any International City Code--City Codes can be found using the Location Search API's
Returns:
{"forecastList":[{"dateTime":1287792000000,"dayDesc":"Partly Cloudy",
"dayIcon":"cond003","dayPred":" Partly cloudy. Mild. Temperature
of 64.51°F. Winds SSE 6.43mph. Humidity will be 68% with a dewpoint
of 54° and feels-like temperature of 64.51°F. ","dayTitle":"Saturday",
"hasDay":true,"hasNight":true,"high":"65","hourly":null,"low":"50",
"nightDesc":"Mostly Cloudy","nightIcon":"cond073","nightPred":
" Mostly cloudy. Mild. Temperature of 64.51°F. Winds E 7.97mph.
Humidity will be 94% with a dewpoint of 48° and feels-like temperature
of 52.75°F. ","nightTitle":"Saturday Night","title":"Saturday"}],
"temperatureUnits":"°F"}
Locations
There are two types of location calls: Location Information and Location Search.
Location Information
Allows you to use a US Zip Code, International City Code, or Latitude/Longitude to get the following additional information as applies to each location:
- City Name
- International City Code
- Country
- DMA
- isUS
- Latitude
- Longitude
- State
- Zip Code
Call By Zip Code Format:
http://i.wxbug.net/REST/Direct/GetLocation.ashx?zip=20876&api_key=xxxxxx
- zip = any US Zip Code, 5 character numeric string
Returns:
{"location":{"city":"Germantown","cityCode":null,"country":"US","dma":"511","isUs":
true,"lat":39.1911,"lon":-77.2346,"state":"MD","zipCode":"20876"}}
Call By City Code Format:
http://i.wxbug.net/REST/Direct/GetLocation.ashx?city=54835&api_key=xxxxxx
- city = any International City Code--City Codes can be found using the Location Search API's
Returns:
{"location":{"city":"Beijing","cityCode":"54835","country":"China","dma":null,"isUs":
false,"lat":39.91,"lon":116.37,"state":null,"zipCode":null}}
Call By Latitude/Longitude Format:
http://i.wxbug.net/REST/Direct/GetLocation.ashx?la=41.7233&lo=-44.7928& api_key=xxxxxx
- la= latitude
- North is positive, South is negative
- double: -90 <= la <= 90
- lo= longitude
- East is positive, West is negative
- double: -180 <= lo <= 180
Returns:
{"location":{"city":"Witless Bay","cityCode":"107461","country":"Canada","dma":null,
"isUs":false,"lat":41.7233,"lon":-44.7928,"state":"NF","zipCode":null}}
Location Search
Returns a list of all possible location matches for a given search string or any combination of city name, state name and/or country name. Information for each location includes:
- City Name
- International City Code
- Country
- DMA
- isUS
- Latitude
- Longitude
- State
- Zip Code
You may also specifiy the culture and language:
- c = culture support, options are c=(US, GB, FR, CA, DE, IT, ES, BR, ZN, TW, JP).
- l= language string, options are l=(en, fr, de, it, es, pt, zh, ja, ko, da, cs, nl, fi, nb, sv)
Call By Search String Format:
http://i.wxbug.net/REST/Direct/GetLocationSearch.ashx?ss=colum&c=US&l=en& api_key=xxxxxx
- ss= search string, alpha-numeric string to allow a free form search
Returns:
{"cityList":[{"city":"Columbe","cityCode":"60207","country":"Ecuador","dma":"","isUs":
false,"lat":-1.88,"lon":-78.7,"state":null,"zipCode":null},
.
.
.
{"city":"Cyclone","cityCode":null,"country":"USA","dma":"514","isUs":true,"lat":41.8143,
"lon":-78.6143,"state":"PA","zipCode":"16726"}]}
Call By City and Country Format:
http://i.wxbug.net/REST/Direct/GetLocationSearch.ashx?ci=Paris&co=France& api_key=xxxxxx
- ci= city name
- co= country name
Returns:
{"cityList":[{"city":"Paris","cityCode":"62827","country":"France","dma":"","isUs":
false,"lat":48.86,"lon":2.35,"state":null,"zipCode":null},
.
.
.
{"city":"Paris 9e","cityCode":"62847","country":"France","dma":"","isUs":false,"lat":
48.87,"lon":2.34,"state":null,"zipCode":null}]}
Call By City, State, and Country Format:
http://i.wxbug.net/REST/Direct/GetLocationSearch.ashx?ci=Rockville&st=MD& co=United%20States&api_key=xxxxxx
- ci= city
- st= state
- co= country
Returns:
{"cityList":[{"city":"Rockville","cityCode":null,"country":"USA","dma":"511","isUs":
true,"lat":39.0838,"lon":-77.1529,"state":"MD","zipCode":"20847"}]}
Observations
Returns observation information from the closest weather station for a given US Zip Code, International City Code or Latitude/Longitude.
You may include the current conditions description and icon (see Icons section at top of page) image in the return by adding the include conditions value to your call:
- units=0 (or left empty) for Fahrenheit, units=1 for Celcius.
- ic= include conditions (optional paramerter)
- ic is a Boolean (0/1) value
- Adding ic=1 to your call will include the current conditions description and icon in your return.
Call By Zip Code and Include Conditions Format:
http://i.wxbug.net/REST/Direct/GetObs.ashx?zip=21044,61820,90210&ic=1& api_key=xxxxxx
- zip = any US Zip Code, 5 character numeric string
- sid = any specific WeatherBug Station ID (optional)
Returns:
[{"__type":"obsData","avgWindDeg":60,"avgWindDirection":"ENE","avgWindSpeed":2,
"dateTime":1282123920000,"desc":"Thunderstorms","dewpoint":66,"feelsLike":68,
"feelsLikeLabel":"Wind Chill","gustDeg":102,"gustDirection":"ESE","gustSpeed":12,
"hasData":true,"humidity":95,"humidityHigh":95,"humidityLow":70,"humidityRate":0,
"humidityUnits":"%","icon":"cond006","press":30.08,"pressHigh":30.09,"pressLow":30.03,
"pressRate":0,"pressUnits":"\"","rainDaily":0.46,"rainMonthly":3.46,"rainRate":0.2,
"rainUnits":"\"","rainYearly":20.92,"rateUnits":"\/h","stationId":"HCLMB","stationName":
"Howard Community College","sunriseDateTime":1282112580566,"sunsetDateTime":
1282161547388,"temperature":68.2,"temperatureHigh":79,"temperatureLow":68,
"temperatureRate":-0.8,"temperatureUnits":"°F","windDeg":59,"windDirection":"ENE",
"windHist":null,"windSpeed":4,"windUnits":"mph"},
.
.
.
{"__type":"obsData","avgWindDeg":211,"avgWindDirection":"SSW","avgWindSpeed":2,
"dateTime":1282113120000,"desc":"Mostly Sunny","dewpoint":61,"feelsLike":66,
"feelsLikeLabel":"Wind Chill","gustDeg":222,"gustDirection":"SW","gustSpeed":6,
"hasData":true,"humidity":84,"humidityHigh":84,"humidityLow":72,"humidityRate":0,
"humidityUnits":"%","icon":"cond026","press":29.89,"pressHigh":29.93,"pressLow":
29.88,"pressRate":0.01,"pressUnits":"\"","rainDaily":0,"rainMonthly":0,"rainRate":0,
"rainUnits":"\"","rainYearly":8.64,"rateUnits":"\/h","stationId":"LSNGN",
"stationName":"Alexander Hamilton Senior HS","sunriseDateTime":1282112224396,
"sunsetDateTime":1282160229337,"temperature":66.1,"temperatureHigh":68,"temperatureLow":
65,"temperatureRate":-0.2,"temperatureUnits":"°F","windDeg":212,"windDirection":"SSW",
"windHist":null,"windSpeed":3,"windUnits":"mph"}]
Call By City Code and Include Conditions Format:
http://i.wxbug.net/REST/Direct/GetObs.ashx?city=54835,61692,54084,77150& ic=1&api_key=xxxxxx
- city = any International City Code--City Codes can be found using the Location Search API's
Returns:
[{"__type":"obsData","avgWindDeg":12,"avgWindDirection":"NNE","avgWindSpeed":0,
"dateTime":1282165200000,"desc":"Hazy","dewpoint":71,"feelsLike":75,"feelsLikeLabel":
"Heat Index","gustDeg":12,"gustDirection":"NNE","gustSpeed":0,"hasData":true,"humidity":
88,"humidityHigh":94,"humidityLow":69,"humidityRate":0,"humidityUnits":"%","icon":
"cond023","press":29.85,"pressHigh":29.85,"pressLow":29.8,"pressRate":0,"pressUnits":
"\"","rainDaily":0,"rainMonthly":0,"rainRate":0,"rainUnits":"\"","rainYearly":0,
"rateUnits":"\/h","stationId":"ZBAA","stationName":"Beijing","sunriseDateTime":
1282195717779,"sunsetDateTime":1282158503164,"temperature":75.2,"temperatureHigh":82,
"temperatureLow":75,"temperatureRate":0,"temperatureUnits":"°F","windDeg":12,
"windDirection":"NNE","windHist":null,"windSpeed":0,"windUnits":"mph"},
.
.
.
{"__type":"obsData","avgWindDeg":112,"avgWindDirection":"ESE","avgWindSpeed":5,
"dateTime":1282143600000,"desc":"Sunny","dewpoint":46,"feelsLike":82,"feelsLikeLabel":
"Heat Index","gustDeg":12,"gustDirection":"NNE","gustSpeed":4,"hasData":true,"humidity":
26,"humidityHigh":28,"humidityLow":26,"humidityRate":0,"humidityUnits":"%","icon":
"cond007","press":29.91,"pressHigh":30,"pressLow":29.91,"pressRate":0,"pressUnits":
"\"","rainDaily":0,"rainMonthly":0,"rainRate":0,"rainUnits":"\"","rainYearly":0,
"rateUnits":"\/h","stationId":"FDMS","stationName":"Manzini (Matsapa)",
"sunriseDateTime":1282112510579,"sunsetDateTime":1282152951576,"temperature":84.2,
"temperatureHigh":84,"temperatureLow":82,"temperatureRate":0,"temperatureUnits":"°F",
"windDeg":111,"windDirection":"ESE","windHist":null,"windSpeed":5,"windUnits":"mph"}]
Call By Latitude/Longitude and Include Conditions Format:
http://i.wxbug.net/REST/Direct/GetObs.ashx?la=41.7233&lo=44.7928&&ic=1& api_key=xxxxxx
- la= latitude
- North is positive, South is negative
- double: -90 <= la <= 90
- lo= longitude
- East is positive, West is negative
- double: -180 <= lo <= 180
Returns:
{"avgWindDeg":312,"avgWindDirection":"NW","avgWindSpeed":2,"dateTime":1282122060000,
"desc":"Mostly Sunny","dewpoint":61,"feelsLike":77,"feelsLikeLabel":"Heat Index",
"gustDeg":1,"gustDirection":"N","gustSpeed":2,"hasData":true,"humidity":57,
"humidityHigh":88,"humidityLow":56,"humidityRate":0,"humidityUnits":"%","icon":
"cond026","press":29.68,"pressHigh":29.79,"pressLow":29.68,"pressRate":0,"pressUnits":
"\"","rainDaily":0,"rainMonthly":0,"rainRate":0,"rainUnits":"\"","rainYearly":0,
"rateUnits":"\/h","stationId":"37228","stationName":"Wladikavkaz","sunriseDateTime":
1282111785181,"sunsetDateTime":1282161610204,"temperature":77.2,"temperatureHigh":78,
"temperatureLow":63,"temperatureRate":0,"temperatureUnits":"°F","windDeg":312,
"windDirection":"NW","windHist":null,"windSpeed":2,"windUnits":"mph"}
Station List
Returns a list of the closest weather stations for a given US Zip Code, International City Code, Latitude/Longitude, or list of Bounding Box coordinates. Up to 20 stations will be returned within a 400-mile radius. By default, only AWS and NWS Stations will be returned. You may add the Include Personal Weather Stations (ipw) parameter to your call to include Personal Weather Stations.
- ipw= include Personal Weather Stations (optional parameter)
- ipw is a Boolean (0/1) value: 1= "yes"
- Adding ipw=1 to your call will include all Personal Weather Stations as well.
Call By Zip Code Format:
http://i.wxbug.net/REST/Direct/GetStation.ashx?zip=91506&ipw=1& api_key=xxxxxx
- zip = any US Zip Code, 5 character numeric string
Returns:
Note that type is one of the following: 1=WeatherBug Weather Stations, 2=National Weather Service Stations, 4=WeatherBug Backyard Stations, 5=Other Networks
{"stationList":[{"city":"Burbank","country":"USA","distance":0.6153,"id":"Ar307",
"isUs":true,"lat":34.1697,"lon":-118.3328,"name":"Burbank","obsData":null,"state":
"CA","type":5},
.
.
.
{"city":"Los Angeles","country":"USA","distance":8.8464,"id":"LNFR3","isUs":true,
"lat":34.0586,"lon":-118.2525,"name":"LA Fire #3","obsData":null,"state":"CA",
"type":1}]}
Call By City Code Format:
http://i.wxbug.net/REST/Direct/GetStation.ashx?city=54835&ipw=1& api_key=xxxxxx
- city = any International City Code--City Codes can be found using the Location Search API's
Returns:
{"stationList":[{"city":"Beijing","country":"China","distance":4.8757,"id":"ZBAA",
"isUs":false,"lat":39.9333,"lon":116.2833,"name":"Beijing","obsData":null,"state":
"WORLD","type":2},
.
.
.
{"city":"","country":"China","distance":322.0897,"id":"54027","isUs":false,"lat":
43.9833,"lon":119.4,"name":"Lindong","obsData":null,"state":"WORLD","type":2}]}
Call By Latitude/Longitude Format:
http://i.wxbug.net/REST/Direct/GetStation.ashx?la=41.7233&lo=-44.7928& ipw=1&api_key=xxxxxx
- la= latitude
- North is positive, South is negative
- double: -90 <= la <= 90
- lo= longitude
- East is positive, West is negative
- double: -180 <= lo <= 180
Returns:
{"stationList":[{"city":"Bayonne","country":"USA","distance":406.6128,"id":"COVM2",
"isUs":true,"lat":38.4297,"lon":-38.4297,"name":"Cove Point","obsData":null,"state":
"NJ","type":5
Call by Bounding Box Format
http://i.wxbug.net/REST/Direct/GetStationByBoundingBox.ashx?tlla=30.76& tllo=-96.95&brla=28.55&brlo=-93.67&api_key=xxxxxx
- tlla= top left latitude
- tllo= top left longitude
- brla=bottom right latitude
- brlo= bottom right longitude
Returns:
{"stationList":[{"city":"25 mi East of Galveston","country":"USA","distance":null,"id":
"42035","isUs":true,"lat":29.2317,"lon":-94.4128,"name":"Galveston Offshore Buoy",
"obsData":null,"state":"TX","type":2}, {"city":"Warren","country":"USA","distance":null,
"id":"WRRNW","isUs":true,"lat":30.5553,"lon":-94.4142,"name":"Warren ES","obsData":null,
"state":"TX","type":1}]}
Alerts
Returns alert information for a given US Zip Code, International City Code or Latitude/Longitude. Currently international alerts are only available for Canada and UK.
Call By Zip Code Format:
http://i.wxbug.net/REST/Direct/GetAlert.ashx?zip=97826&api_key=xxxxxx
- zip = any US Zip Code, 5 character numeric string
Returns:
{"alertCount":1,"alertList":[{"alertId":"nws97561010","dateTimeBegins":null,
"dateTimeBeginsUtc":null,"dateTimeEnds":1282125600000,"dateTimeEndsUtc":1282150800000,
"dateTimeExpires":1282125600000,"dateTimeExpiresUtc":1282150800000,"dateTimePosted":
1282113960000,"dateTimePostedUtc":1282139160000,"description":"Fire Weather Warning",
"id":97561010,"message":" Urgent - Fire Weather MessageNational Weather Service
Pendleton OR646 AM PDT Wed Aug 18 2010\u000d\u000a\u000d\u000a East Slopes Of North
Oregon Cascades-Columbia Basin Of Oregon-\u000d\u000a\u000d\u000a...Red Flag Warning
Remains In Effect Until 10 AM PDT ThisMorning For Thunderstorms Producing Abundant
Lightning...\u000d\u000a\u000d\u000a* Affected Area: In Oregon...Fire Zone 609 East
Slopes Of North Oregon Cascades...Fire Zone 631 Columbia Basin Of Oregon.
\u000d\u000a\u000d\u000a* Timing: Thunderstorms Will Continue This Morning But Decrease
As The Low Pressure System Moves East Today.\u000d\u000a\u000d\u000a* Lightning
Activity: Primarily Lal 3 Activity With An Occasional Lal 4 Activity Storm.
\u000d\u000a\u000d\u000a* Impacts: Some Storms Will Produce Little Or No Rain At The
Surface. Gusty Northwest Winds May Develop Again This Morning.
\u000d\u000a\u000d\u000aPrecautionary\/Preparedness Actions...\u000d\u000a\u000d\u000aA
Red Flag Warning Means That Critical Fire Weather Conditions Are Either Occurring Now...
Or Will Shortly. These Conditions WillCreate The Potential For Explosive Fire Growth.
For Additional Weather Information...Visit Our Web Site At
Www.Weather.Gov\/Pendleton.\u000d\u000a\u000d\u000a&&","typeId":105}],
"supportsAlerts":true}
Call By City Code Format:
http://i.wxbug.net/REST/Direct/GetAlert.ashx?city=800597&api_key=xxxxxx
- city = any International City Code--City Codes can be found using the Location Search API's
Returns:
{"alertCount":0,"alertList":[],"supportsAlerts":true}
Call By Latitude/Longitude Format:
http://i.wxbug.net/REST/Direct/GetAlert.ashx?la=44.2542&lo=-121.1500&api_key=xxxxxxx
- la= latitude
- North is positive, South is negative
- double: -90 <= la <= 90
- lo= longitude
- East is positive, West is negative
- double: -180 <= lo <= 180
Returns:
{"alertCount":1,"alertList":[{"alertId":"nws97561010","dateTimeBegins":null,
"dateTimeBeginsUtc":null,"dateTimeEnds":1282125600000,"dateTimeEndsUtc":1282150800000,
"dateTimeExpires":1282125600000,"dateTimeExpiresUtc":1282150800000,"dateTimePosted":
1282113960000,"dateTimePostedUtc":1282139160000,"description":"Fire Weather Warning",
"id":97561010,"message":" Urgent - Fire Weather MessageNational Weather Service
Pendleton OR 646 AM PDT Wed Aug 18 2010\u000d\u000a\u000d\u000a East Slopes Of North
Oregon Cascades-Columbia Basin Of Oregon-\u000d\u000a\u000d\u000a...Red Flag Warning
Remains In Effect Until 10 AM PDT ThisMorning For Thunderstorms Producing Abundant
Lightning...\u000d\u000a\u000d\u000a* Affected Area: In Oregon...Fire Zone 609 East
Slopes Of North Oregon Cascades...Fire Zone 631 Columbia Basin Of Oregon.
\u000d\u000a\u000d\u000a* Timing: Thunderstorms Will Continue This Morning But Decrease
As The Low Pressure System Moves East Today.\u000d\u000a\u000d\u000a* Lightning
Activity: Primarily Lal 3 Activity With An Occasional Lal 4 Activity Storm.
\u000d\u000a\u000d\u000a* Impacts: Some Storms Will Produce Little Or No Rain At The
Surface. Gusty Northwest Winds May Develop Again This Morning.\u000d\u000a\u000d\u000a
Precautionary\/Preparedness Actions...\u000d\u000a\u000d\u000aA Red Flag Warning Means
That Critical Fire Weather Conditions Are Either Occurring Now...Or Will Shortly. These
Conditions Will Create The Potential For Explosive Fire Growth. For Additional Weather
Information...Visit Our Web Site At Www.Weather.Gov\/Pendleton.
\u000d\u000a\u000d\u000a&&","typeId":105}],"supportsAlerts":true}
UV Index
Returns UV Index information for a given US Zip Code. Currently, this is only available for US locations.
Call by Zip Code Format:
http://i.wxbug.net/REST/Direct/GetUv.ashx?zip=21044&api_key=xxxxxxx
-
zip = any US Zip Code, 5 character numeric string
Returns:
{"city":"BALTIMORE","dayList":[{"color":"#FC6901","dateTime":1285545600000,"desc":"High",
"index":6},{"color":"#FC6901","dateTime":1285459200000,"desc":"High","index":6}],"state":"MD"}
Combining Multiple JSON feed calls
You can combine multiple JSON feed requests together to limit the number of calls to the API. An example is provided below.
http://i.wxbug.net/REST/Direct/GetData.ashx?zip=21044&dt=l&dt=o&ic=1&dt=f&nf=4&dt=a&api_key=
zip code = self explanatory
dt = l (Data type = location)
dt = o (Data type = observations)
dt = f (Data type = forecast)
nf = number of forecast periods to include
dt = a (Data type = alerts)
The above call includes, the location, observations, forecast and alerts all in a single call. Any of the modifiers used for observations or forecasts can be included in this list. For example ic=1 will include current conditions.
Here is another example that shows a call with Lat/Lon..
http://i.wxbug.net/REST/Direct/GetData.ashx?la=37&lo=-77&dt=l&dt=o&ic=1&dt=f&nf=4&dt=a&api_key=
[{"__type":"obsData","avgWindDeg":60,"avgWindDirection":"ENE","avgWindSpeed":2,"dateTime":1282123920000,"desc":"Thunderstorms","dewpoint":66,"feelsLike":68,"feelsLikeLabel":"Wind Chill","gustDeg":102,"gustDirection":"ESE","gustSpeed":12,"hasData":true,"humidity":95,"humidityHigh":95,"humidityLow":70,"humidityRate":0,"humidityUnits":"%","icon":"cond006","press":30.08,"pressHigh":30.09,"pressLow":30.03,"pressRate":0,"pressUnits":"\"","rainDaily":0.46,"rainMonthly":3.46,"rainRate":0.2,"rainUnits":"\"","rainYearly":20.92,"rateUnits":"\/h","stationId":"HCLMB","stationName":"Howard Community College","sunriseDateTime":1282112580566,"sunsetDateTime":1282161547388,"temperature":68.2,"temperatureHigh":79,"temperatureLow":68,"temperatureRate":-0.8,"temperatureUnits":"°F","windDeg":59,"windDirection":"ENE","windHist":null,"windSpeed":4,"windUnits":"mph"},{"__type":"obsData","avgWindDeg":81,"avgWindDirection":"E","avgWindSpeed":14,"dateTime":1282117980000,"desc":"Chance Rain Shower","dewpoint":62,"feelsLike":70,"feelsLikeLabel":"Heat Index","gustDeg":82,"gustDirection":"E","gustSpeed":13,"hasData":true,"humidity":76,"humidityHigh":84,"humidityLow":76,"humidityRate":0,"humidityUnits":"%","icon":"cond041","press":30.08,"pressHigh":30.1,"pressLow":30.08,"pressRate":0,"pressUnits":"\"","rainDaily":0,"rainMonthly":0,"rainRate":0,"rainUnits":"\"","rainYearly":0,"rateUnits":"\/h","stationId":"KCMI","stationName":"University Of Illinois-Willard","sunriseDateTime":1282111633812,"sunsetDateTime":1282160759039,"temperature":70,"temperatureHigh":70,"temperatureLow":66,"temperatureRate":0,"temperatureUnits":"°F","windDeg":81,"windDirection":"E","windHist":null,"windSpeed":14,"windUnits":"mph"},{"__type":"obsData","avgWindDeg":211,"avgWindDirection":"SSW","avgWindSpeed":2,"dateTime":1282113120000,"desc":"Mostly Sunny","dewpoint":61,"feelsLike":66,"feelsLikeLabel":"Wind Chill","gustDeg":222,"gustDirection":"SW","gustSpeed":6,"hasData":true,"humidity":84,"humidityHigh":84,"humidityLow":72,"humidityRate":0,"humidityUnits":"%","icon":"cond026","press":29.89,"pressHigh":29.93,"pressLow":29.88,"pressRate":0.01,"pressUnits":"\"","rainDaily":0,"rainMonthly":0,"rainRate":0,"rainUnits":"\"","rainYearly":8.64,"rateUnits":"\/h","stationId":"LSNGN","stationName":"Alexander Hamilton Senior HS","sunriseDateTime":1282112224396,"sunsetDateTime":1282160229337,"temperature":66.1,"temperatureHigh":68,"temperatureLow":65,"temperatureRate":-0.2,"temperatureUnits":"°F","windDeg":212,"windDirection":"SSW","windHist":null,"windSpeed":3,"windUnits":"mph"}]
- Previous: WeatherBug REST XML API
- Up: Introduction
- Next: Google GEO API Example
10 Comments
cuacabug – 2 years ago
Chris, does the API capable of pulling past weather data, like yesterday weather information?
Chris Sloop – 2 years ago
Hi, you can get past weather data from our Microsoft data market API. Currently we do not have a historical API for JSON. I don;t have any timing on that right now either, but it is something we really want to do...
Here is a link to Microsoft Data market: https://datamarket.azure.com/dataset/10a6465f-b0a6-49ca-9175-b24caaf74db0
thung – 2 years ago
Is there a way to set UnitType to return either US units or metric units, just as the REST XML API does?
thung – 2 years ago
For the GetForecast API
Chris Sloop – 2 years ago
thung, I will email you directly.
Soren_B – 1 year ago
Hi,
How often are the data updated?
Now it's Fri, 20 Apr 2012 10:25:00 but the most recent UV Index has "dateTime":1334880000000 =Thu Apr 19 2012 17:00:00 (Local time) = Fri, 20 Apr 2012 00:00:00 (UTC)
That's not much if a forecast... So how often is the data updated?
maaxzoom – 9 months ago
I need to get weather for few locations (stored in array), by calling jsonp.
How can I do something like below but for weatherbug url:
RossW – 6 months ago
Hi, I'm a new user - but I can't find any reference to the interpretation of the returned dateTime value. It LOOKS like a unix epoc, but when I request current information, the timestamp returned is for something 18 months ago.
date
Fri Nov 30 08:29:34 EST 2012
Return from a REST query includes: {dateTime:1354223549000,id:440703741,point:{lat:-36.5725,lon:138.7685}}
date -r 1354223549000
Fri Jun 24 03:39:20 EST 2011
That they all end in 000 makes me wonder if they may not be times in seconds expressed as milliseconds - but what's the epoc used??
RossW – 6 months ago
Its ok, I've answered my own question..... it is a unix timestamp - multiplied by 1000.
./lightning.sh
Received 31 Records => 30-Nov-2012.08:43:51 -35.4803 139.4575 => 30-Nov-2012.08:44:05 -15.238 152.9967 => 30-Nov-2012.08:44:10 -32.5045 136.5696 => 30-Nov-2012.08:44:10 -32.5027 136.5975 => 30-Nov-2012.08:44:25 -33.4571 137.7345 => 30-Nov-2012.08:44:53 -15.5018 153.1292
test123 – 3 months ago
Can this api be integrated with Leaflet?
Please sign in to post a comment.