An Overview of the Aurora API

The Aurora API is a public API that provides access to live and historical data about the aurora borealis. This data includes current aurora status, location, and forecast information. The API can be used to help you plan aurora viewing trips or to create your own aurora monitoring tools.

In this blog post, we'll provide an overview of the Aurora API and provide some JavaScript code examples to help you get started with the API.

API Endpoints

The Aurora API has several endpoints that provide access to different types of information.

Current Aurora Data

The /api/v1/current endpoint provides data on the current status of the aurora. This information includes latitude and longitude coordinates, the current Kp index, and a description of the current aurora activity level.

Here's an example of how you could use JavaScript to get the current aurora data:

fetch('http://auroraslive.io/api/v1/current')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error));

Historical Aurora Data

The /api/v1/historical endpoint provides access to historical data on the aurora. This data includes aurora activity levels, latitude and longitude coordinates, and Kp index values.

To access historical aurora data, you'll need to provide a start date and end date for the data you'd like to retrieve. Here's an example of how you could use JavaScript to get historical aurora data for the month of September 2021:

const startDate = '2021-09-01';
const endDate = '2021-09-30';

const url = `http://auroraslive.io/api/v1/historical?start=${startDate}&end=${endDate}`;

fetch(url)
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error));

Aurora Forecast Data

The /api/v1/forecast endpoint provides access to aurora forecasts. This data includes predicted Kp index values and the likelihood of aurora activity occurring.

Here's an example of how you could use JavaScript to get an aurora forecast:

fetch('http://auroraslive.io/api/v1/forecast')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error));

Conclusion

The Aurora API provides access to a wealth of information on the aurora borealis. Whether you're a researcher, photographer, or just a curious aurora watcher, the API can help you better understand and appreciate this beautiful natural phenomenon. By using the JavaScript code examples provided in this blog post, you'll be well on your way to exploring all that the Aurora API has to offer.

Related APIs