Aeris API

AerisThe Aeris API is one of the most complete and advanced weather APIs available and quickly gives you access to many different types of weather information. Not only is Aeris weather content easy and flexible to use, but our set of mobile and web toolkits integrate with our core API to provide you with everything you need to get weather integrated into any web or mobile application.

Getting Started
  1. Sign up for an Aeris API subscription service.
  2. Log in to your account to register your application for an API access key. Each application requires its own unique access key.
  3. Familiarize yourself with the variety of features available.
  4. Review our mobile and web weather toolkits to speed up your weather content development.
  5. Find the endpoints and actions that provide you with the data you need in order to work with the API directly.
Requesting Data

Once you’ve signed up for the Aeris Weather API and have an active client id and secret for your application, you’re ready to start creating some requests. The following are some very basic code samples for various programming languages to help you get started with the API.

Secure API Access

When secure connections to the API are required, the HTTPS protocol can be utilized with the API, by querying with “https” in place of “http”. For example:

https://api.aerisapi.com/places/closest?p=43.567,-100.895&limit=5&client_id=YoxQRtk3ImdaLfK5lVj&client_secret=MbnZEgm5tDKCxoMkXm5DTWHYM9ewIrzD5kOyyys

PHP

<?php
// fetch Aeris API output as a string and decode into an object
$response = file_get_contents("http://api.aerisapi.com/observations/seattle,wa?client_id=CLIENT_ID&client_secret=CLIENT_SECRET");
$json = json_decode($response);
if ($json->success == true) {
	// create reference to our returned observation object
	$ob = $json->response->ob;
	echo sprintf("The current weather in Seattle is %s with a temperature of %d.", strtolower($ob->weather), $ob->tempF);
}
else {
	echo sprintf("An error occurred: %s", $json->error->description);
}
?>
Javascript (with jQuery)

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript">
	jQuery(document).ready(function($) {
		$.ajax({
			url: "http://api.aerisapi.com/observations/seattle,wa?client_id=CLIENT_ID&client_secret=CLIENT_SECRET",
			dataType: "jsonp",
			success: function(json) {
				if (json.success == true) {
					var ob = json.response.ob;
					$('#js').html('The current weather in Seattle is ' + ob.weather.toLowerCase() + ' with a temperature of ' + ob.tempF + '°');
				}
				else {
					alert('An error occurred: ' + json.error.description);
				}
			}
		});
	});
</script>
<div id="js"></div>
Ruby

#!/usr/bin/env ruby

require 'rubygems'
require 'open-uri'
require 'json'

url = 'http://api.aerisapi.com/observations/seattle,wa?client_id=CLIENT_ID&client_secret=CLIENT_SECRET'
buffer = open(url, "UserAgent" => "Ruby-Wget").read

#convert JSON data into a hash
response = JSON.parse(buffer)
ob = response['response']['ob']
print "The current weather in Seattle is " + ob['weather'].downcase + ' with a temperature of ' + ob['tempF'].to_s() + "\n"
Python

import urllib2
import json

request = urllib2.urlopen('http://api.aerisapi.com/observations/seattle,wa?client_id=CLIENT_ID&client_secret=CLIENT_SECRET')
response = request.read()
json = json.loads(response)
if json['success']:
	ob = json['response']['ob']
	print "The current weather in Seattle is %s with a temperature of %d" % (ob['weather'].lower(), ob['tempF'])
else:
	print "An error occurred: %s" % (json['error']['description'])
request.close()