Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.
Want to share the latest weather details with your website visitors? Widgets and other code that display location-based weather forecasts are increasingly popular, particularly on news and sports-based sites. Such details also appear on mobile apps and even home screens.
This is thanks to APIs (application programming interfaces), which are essentially software that you use for building other software. Here’s how weatherstack API lets you add weather data to your website.
Why Does Your Site or App Need a Weather API?
Unless you’re prepared to maintain your own database of current weather around the world, your websites need a weather API. It’s either this, or checking the weather manually for every single visitor or app user. Obviously, doing so is out of the question.
Weather APIs provide access to collated data from weather stations. This allows for the provision of live weather information to end users via websites, apps, or even desktop widgets.
All you need to do is access an API endpoint and format the data to provide information to your users.
What You Can Do With Weatherstack API
The weatherstack API features a collection of tools for a variety of programming languages, backed up by location-based weather data. Six endpoints are available:
- Current Weather: Delivers current weather data.
- Historical Weather: View historical weather data.
- Historical Time-Series: Returns historical time-series weather data.
- Weather Forecast: Get weather forecasts for up to 14 days.
- Location Lookup: Check weather at one or multiple locations.
Meanwhile, weatherstack API also promises hour-by-hour weather data for millions of locations worldwide. The data is delivered in milliseconds from a server with almost 100 percent uptime.
Interested in creating a weather app with the weatherstack API? Try it out with the free signup. This is perfect for development and offers a great entry point to commercial use of the service. In short, you could publish an app or service using the weatherstack API and potentially earn money from it.
Weatherstack API Pricing Guide
The free weatherstack API package gives you 1,000 API calls per month. A “call” is a single instance use of the API data, and at this level is ideal for development.
Once you’ve got your app up and running, you have several project levels to step up to:
- Standard: $9.99 per month ($7.99 if billed yearly). It includes 50,000 API calls a month, unlimited support, real-time weather, location lookup, HTTPS encryption, astronomy data, hour-by-hour data, and full historical data.
- Professional: $49.99 per month ($39.99 with yearly billing). This allows for 300,000 calls and all the above features, plus 7-day forecasts, support for 40 languages, and bulk queries.
- Business: $99.99 per month ($79.99 if billed yearly). This option gives you 1,000,000 calls, premium support, and 14-day forecast data.
There is also an Enterprise package offering additional features, dedicated support, custom solutions, and more. If your project runs at this scale, weatherstack API will negotiate a price with you. Among weatherstack API’s satisfied customers are Deloitte, Microsoft, Warner Bros., and Schneider Electric.
Get Started With Weatherstack API
Anyone can get started by accessing the weatherstack API at no charge. Head to the weatherstack API signup page to create a free account. You don’t need to provide any payment details at this stage.
After account setup, you’ll get access to an API key. This personal key authenticates you with the API; if necessary you can reset it in the account dashboard screen. (It is also here that you’ll find details of your current weatherstack API plan.)
You can play around with the API initially in your browser window. Returned data is displayed in your browser window in JSON format. You can improve how this looks by installing a browser extension such as JSON Viewer.
Going forward with development, however, you’ll need a suitable integrated development environment (IDE).
Using the Weatherstack API Output
The basic API output from weatherstack lets you pull the current weather for a specific location.
http://api.weatherstack.com/current ? access_key = YOUR_ACCESS_KEY & query = New York
You can also include additional optional parameters:
// optional parameters: & units = m & language = en & callback = MY_CALLBACK
The same pattern repeats throughout the various API calls. The core command is required text, while you can choose to set optional parameters if you wish.
Here’s a secondary example, using the Historical Weather API Endpoint. This time, you can specify a date for weather data.
// Historical Weather API Endpoint http://api.weatherstack.com/historical ? access_key = YOUR_ACCESS_KEY & query = New York & historical_date = 2015-21-01 // optional parameters: & hourly = 1 & interval = 3 & units = m & language = en & callback = MY_CALLBACK
Again, the basic output from the API will display in your browser window. Note that free accounts can only use the Current Weather API.
Using the JSON Data From Weatherstack API
You can take advantage of the JSON output from weatherstack API in several ways. If you’re familiar with PHP, Python, Node, jQuery, and Ruby, for example, you can use the data in an app or display it on a web page.
For web pages, you’ll need the code file to grab the JSON data, the HTML file, and a CSS. In most cases, you’ll also need some style elements to make it slightly more readable!
Put Global Weather Data on Your Website or App
Clearly, the weatherstack API is a great solution for anyone who needs an affordable and straightforward weather API for their site. You can find out more about the API’s details and documentation at weatherstack.com.
As it’s compatible with PHP, Python, Node, jQuery, and Ruby, weatherstack API could revolutionize weather updates on your website. The historical aspects of the API are particularly useful too.
With a free signup for development use and affordable price plans going forward, weatherstack API is certainly a look.
Looking for other APIs? We’ve also reviewed the IP Geolocation API, which provides an easy way to get started with geolocation data. We also reviewed the Scrapestack API, which efficiently scrapes data from websites, along with the Serpstack API for scraping search data.