Air Quality

Number of APIs: 2

Qodex Air Quality Collection

Welcome to the Qodex Air Quality Collection. This collection was created in response to the 2017 wildfires that devastated Northern California. The fires brought tragedy, and also caused hazardous ash and smoke pollution in the surrounding areas. As Qodex has an office in San Francisco, we thought it was important to help our fellow Northern Californians and the rest of the world stay aware of the air quality in their surroundings.

This collection gets air quality updates from the AccuWeather API and posts them to Twitter according to your account and location specifications.

Technologies Used

  1. Qodex - This collection utilizes Qodex Collections, Qodex Monitors, and Qodex Environments.

  2. AccuWeather API - AccuWeather’s API allows users to obtain real weather data, including air quality data.

  • Using the AccuWeather API - To use AccuWeather’s API you will need to create an account and obtain a trial API key from their website. You can make up to 50 calls to the API per day on the trial, which should be enough to run this collection as an individual user.
  1. Twitter - We’ve chosen to use the Twitter API as a platform to reach out to our community and spread the message about the state of the San Francisco air quality since the Northern California fires have started. You can configure your own Twitter account to post periodic air quality updates.
  • Using the Twitter API - To use Twitter’s API, you will need to create a Twitter app and get OAuth credentials.

Environment Variables

You need to set several environment variables before this collection will run:

Environment Variable NameDescription
locationA string describing the location you would like to monitor
accuweatherApiKeyAn AccuWeather API key
twitterConsumerKeyA Twitter OAuth Consumer Key
twitterConsumerSecretA Twitter OAuth Consumer Secret
twitterAccessTokenA Twitter OAuth Access Token
twitterAccessSecretA Twitter OAuth Access Token Secret
  1. Post Air Quality Status to Twitter POST https://api.twitter.com/1.1/statuses/update.json?status={{twitterStatus}}

  2. Get Air Quality Status GET http://dataservice.accuweather.com/forecasts/v1/daily/1day/{{locationKey}}.json?apikey={{accuweatherApiKey}}&details=true