Getting Started

You'll need an active AerisWeather API subscription and your application registered with the weather API in order to receive the required access ID and secret key.

Step 1: Sign up for an AerisWeather API subscription service. We offer a free developer account for you to give our weather API a test drive.

Step 2: Log in to your account and find the Apps section to register your application for an API access key. Within the Apps section, click on New Application to register a new app. You will then be prompted to enter a project name and namespace. These can be updated at any time.
new application example

Step 3: Find the endpoints and actions that provide you with the data you need in order to work with the weather API directly.

Step 4: Review our weather toolkits to speed up your weather integration during development.

Basic API Requests

Once you’ve signed up for the AerisWeather 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 weather API:

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 (w/jQuery)


<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
   jQuery(document).ready(function($) {
      $.ajax({
         url: "https://api.aerisapi.com/observations/seattle,wa?client_id=CLIENT_ID&client_secret=CLIENT_SECRET"
      })
      .done(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 + '&deg;');
            }
            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 urllib
import json

request = urllib.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()

For more Python examples, check out our Python SDK!

Last modified: July 22, 2020