getWeather API

Barchart OnDemand's getWeather API provides current conditions and forecasts based on zip code. As well as weather maps based on type or region.

All APIs

Contact Us to Get Access

Inputs

weatherType optional

The type of weather requested. Includes: Current Conditions ("CC") and Forecast ("F").

Type
enum (A type which includes a list of valid possible values.) 
Example
CC 
Default
CC 

Valid Values:
CC, F, MAP

zipCode optional

The zip code of the location as a 5-digit numeric value.

Type
string (A sequence of characters. (example: GOOG)) 
Example
60606 
Default
60606 

fields optional

The fields requested.

Type
list (A comma or semi-colon delimited string.) 
Example
windDirection,windSpeed,humidity,dewpoint,forcastedDay,forcastedPrecipitation 

mapType optional

The type of map required. Only valid when using the "MAP" weatherType.

Type
enum (A type which includes a list of valid possible values.) 

Valid Values:
localRadarAnimation, usRadarSatellite, usRadarSatelliteAnimation, todaysWeatherMap, currentWindConditions, todaysPrecipitationAccumulation, dailyPrecipitation, usSoilMoisture, usCurrentTemperatures

mapRegion optional

The region of map required.

Type
enum (A type which includes a list of valid possible values.) 

Valid Values:
centralPlains, dakotas, californiaArizona, colorado, deepSouth, delta, farWest, florida, greatBasin, greatLakes, midAtlantic, montana, northEast, ohioValley, pacificNorthwest, rockyMountains, southAtlantic, southPlains, southTexas, southWest

mapWidth optional

The width of the map.

Type
int (A numeric type defining a whole number. (example: 2)) 
Example
255 
Default
560 

mapHeight optional

The height of the map.

Type
int (A numeric type defining a whole number. (example: 2)) 
Example
220 
Default
440 

Outputs

Name / Requirement
Description
Type
weatherType
always returned
The type of weather requested. Includes: Current Conditions ("CC") or Forecast ("F").
string
A sequence of characters. (example: GOOG)
zipCode
always returned
The zip code of the location.
string
A sequence of characters. (example: GOOG)
location
always returned
The city or town related to the zip code.
string
A sequence of characters. (example: GOOG)
currentCondition
always returned
The descriptive of the current condition.
string
A sequence of characters. (example: GOOG)
currentConditionIcon
always returned
The condition icon's URL.
string
A sequence of characters. (example: GOOG)
currentTemperature
always returned
The current temperature.
string
A sequence of characters. (example: GOOG)
currentPressure
always returned
The current atmospheric pressure in Hg.
string
A sequence of characters. (example: GOOG)
feelsLike
always returned
The current feels like temperature.
string
A sequence of characters. (example: GOOG)
windDirection
as requested
The current wind direction.
string
A sequence of characters. (example: GOOG)
windSpeed
as requested
The current wind speed.
string
A sequence of characters. (example: GOOG)
humidity
as requested
The current level of humidity.
string
A sequence of characters. (example: GOOG)
dewpoint
as requested
The current dew point.
string
A sequence of characters. (example: GOOG)
forecastedDay
as requested
The name of the day of the week forecasted.
string
A sequence of characters. (example: GOOG)
forcastedPrecipitation
as requested
The amount of forecasted precipitation in inches.
string
A sequence of characters. (example: GOOG)
chancePrecipitationDay
as requested
The daytime chance of precipitation.
string
A sequence of characters. (example: GOOG)
chancePrecipitationNight
as requested
The nighttime chance of precipitation.
string
A sequence of characters. (example: GOOG)
windchill
as requested
The forecasted windchill temperature.
string
A sequence of characters. (example: GOOG)
dewFrostWeight
as requested
The dew/frost weight.
string
A sequence of characters. (example: GOOG)
hoursSun
as requested
The hours of sunlight for today.
string
A sequence of characters. (example: GOOG)
soilMoisture
as requested
The current soil moisture.
string
A sequence of characters. (example: GOOG)
evaporation
as requested
The current level of evaporation.
string
A sequence of characters. (example: GOOG)
dryingIndex
as requested
The current drying index.
string
A sequence of characters. (example: GOOG)
solarRadiation
as requested
The current level of solar radiation.
string
A sequence of characters. (example: GOOG)
livestockSafteyIndex
as requested
The current livestock safety index.
string
A sequence of characters. (example: GOOG)
cumulativeHDD
as requested
The cumulative heating degree days.
string
A sequence of characters. (example: GOOG)
cumulativeGDD
as requested
The cumulative growing degree days.
string
A sequence of characters. (example: GOOG)
forecastDayCondition
as requested
A descriptive of the weather forecasted for the day.
string
A sequence of characters. (example: GOOG)
forecastDayConditionIcon
as requested
The condition icon's URL.
string
A sequence of characters. (example: GOOG)
forecastNightCondition
as requested
A descriptive of the weather forecasted for the night.
string
A sequence of characters. (example: GOOG)
forecastNightConditionIcon
as requested
The condition icon's URL.
string
A sequence of characters. (example: GOOG)
forecastHighTemperature
as requested
The forecasted high temperature for the day.
string
A sequence of characters. (example: GOOG)
forecastLowTemperature
as requested
The forecasted low temperature for the day.
string
A sequence of characters. (example: GOOG)
mapRegion
always returned
The map region.
string
A sequence of characters. (example: GOOG)
mapType
always returned
The map type.
string
A sequence of characters. (example: GOOG)
mapUrl
always returned
The map image's URL.
string
A sequence of characters. (example: GOOG)

Status Code Responses

200
OK
Success
400
Bad Request
The request was invalid, please see the message for more information.
500
Internal Server Error
Something is not working correctly, please contact support.


JSON

GET

GET https://ondemand.websol.barchart.com/getWeather.json?apikey=YOUR_API_KEY&weatherType=CC&zipCode=60606&fields=windDirection%2CwindSpeed%2Chumidity%2Cdewpoint%2CforcastedDay%2CforcastedPrecipitation&mapWidth=255&mapHeight=220
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getWeather.json
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=YOUR_API_KEY&weatherType=CC&zipCode=60606&fields=windDirection%2CwindSpeed%2Chumidity%2Cdewpoint%2CforcastedDay%2CforcastedPrecipitation&mapWidth=255&mapHeight=220

Response

{
    "status": {
        "code": 200,
        "message": "Success."
    },
    "results": [
        {
            "weatherType": "CC",
            "zipCode": "60606",
            "location": "Chicago, Illinois",
            "currentCondition": "Partly Cloudy",
            "currentConditionIcon": "http:\/\/shared.websol.barchart.com\/images\/weather\/pcldyicon.jpg",
            "currentTemperature": "74°F",
            "currentPressure": "29.96 in. Hg",
            "feelsLike": "76°F",
            "windDirection": "North",
            "windSpeed": "4 mph",
            "humidity": "66%",
            "dewpoint": "62°F",
            "forcastedPrecipitation": null,
            "mapRegion": null,
            "mapType": "localRadarAnimation",
            "mapUrl": "http:\/\/shared.websol.barchart.com\/weather\/weathermap.php\/interrad?zipcode=60606&width=255&height=220"
        }
    ]
}

XML

GET

GET https://ondemand.websol.barchart.com/getWeather.xml?apikey=YOUR_API_KEY&weatherType=CC&zipCode=60606&fields=windDirection%2CwindSpeed%2Chumidity%2Cdewpoint%2CforcastedDay%2CforcastedPrecipitation&mapWidth=255&mapHeight=220
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getWeather.xml
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=YOUR_API_KEY&weatherType=CC&zipCode=60606&fields=windDirection%2CwindSpeed%2Chumidity%2Cdewpoint%2CforcastedDay%2CforcastedPrecipitation&mapWidth=255&mapHeight=220

Response


<?xml version="1.0" encoding="utf-8"?>
 <getWeather>
  <status>
   <code>200</code>
   <message>Success.</message>
  </status>
  <item>
   <weatherType>CC</weatherType>
   <zipCode>60606</zipCode>
   <location>Chicago, Illinois</location>
   <currentCondition>Partly Cloudy</currentCondition>
   <currentConditionIcon>http://shared.websol.barchart.com/images/weather/pcldyicon.jpg</currentConditionIcon>
   <currentTemperature>74&amp;deg;F</currentTemperature>
   <currentPressure>29.96 in. Hg</currentPressure>
   <feelsLike>76&amp;deg;F</feelsLike>
   <windDirection>North</windDirection>
   <windSpeed>4 mph</windSpeed>
   <humidity>66%</humidity>
   <dewpoint>62&amp;deg;F</dewpoint>
   <forcastedPrecipitation></forcastedPrecipitation>
   <mapRegion></mapRegion>
   <mapType>localRadarAnimation</mapType>
   <mapUrl>http://shared.websol.barchart.com/weather/weathermap.php/interrad?zipcode=60606&amp;width=255&amp;height=220</mapUrl>
  </item>
 </getWeather>

CSV

GET

GET https://ondemand.websol.barchart.com/getWeather.csv?apikey=YOUR_API_KEY&weatherType=CC&zipCode=60606&fields=windDirection%2CwindSpeed%2Chumidity%2Cdewpoint%2CforcastedDay%2CforcastedPrecipitation&mapWidth=255&mapHeight=220
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getWeather.csv
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=YOUR_API_KEY&weatherType=CC&zipCode=60606&fields=windDirection%2CwindSpeed%2Chumidity%2Cdewpoint%2CforcastedDay%2CforcastedPrecipitation&mapWidth=255&mapHeight=220

Response

weatherType,zipCode,location,currentCondition,currentConditionIcon,currentTemperature,currentPressure,feelsLike,windDirection,windSpeed,humidity,dewpoint,forcastedPrecipitation,mapRegion,mapType,mapUrl
"CC","60606","Chicago, Illinois","Partly Cloudy","http://shared.websol.barchart.com/images/weather/pcldyicon.jpg","74&deg;F","29.96 in. Hg","76&deg;F","North","4 mph","66%","62&deg;F","","","localRadarAnimation","http://shared.websol.barchart.com/weather/weathermap.php/interrad?zipcode=60606&width=255&height=220"


PHP

<?php

$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');

$params = [
    'apikey' => 'YOUR_API_KEY',
    'weatherType' => 'CC',
    'zipCode' => '60606',
    'fields' => 'windDirection,windSpeed,humidity,dewpoint,forcastedDay,forcastedPrecipitation',
    'mapWidth' => '255',
    'mapHeight' => '220',
];

$result = $ondemand->getWeather($params);
var_dump($result);

Classic ASP

Dim ondemand
Dim result

Set ondemand = Server.CreateObject("MSSOAP.SoapClient30")
ondemand.ClientProperty("ServerHTTPRequest") = True
ondemand.MSSoapInit("https://ondemand.websol.barchart.com/service?wsdl")

Set result = ondemand.getWeather("YOUR_API_KEY", "CC", "60606", "windDirection,windSpeed,humidity,dewpoint,forcastedDay,forcastedPrecipitation", "255", "220")

Perl

use SOAP::Lite;
use SOAP::WSDL;

my $ondemand = SOAP::Lite
    -> service('https://ondemand.websol.barchart.com/service?wsdl');

my $result = $ondemand->getWeather('YOUR_API_KEY', 'CC', '60606', 'windDirection,windSpeed,humidity,dewpoint,forcastedDay,forcastedPrecipitation', '255', '220');

print $result;

Python

from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')

result = client.service.getWeather('YOUR_API_KEY', 'CC', '60606', 'windDirection,windSpeed,humidity,dewpoint,forcastedDay,forcastedPrecipitation', '255', '220')

print result

Ruby

require 'savon'

ondemand = Savon.client(wsdl: 'https://ondemand.websol.barchart.com/service?wsdl')

response = ondemand.call(
    :getWeather,
    message: {
        apikey: 'YOUR_API_KEY',
        weatherType: 'CC',
        zipCode: '60606',
        fields: 'windDirection,windSpeed,humidity,dewpoint,forcastedDay,forcastedPrecipitation',
        mapWidth: '255',
        mapHeight: '220',
    }
)

response.body