Table of Contents
Welcome back to #12DaysOfAPIs! Today, we’re blasting off with the NASA API.
What you can do with the NASA API
We can pretty all much agree, space is awesome.
Navigating the all of NASA’s APIs though is a little tricky. According to Programmable Web, NASA has 62 (!!) public APIs. While NASA’s API developer portal and articles like these definitely help, we decided to build a NASA API package that combines some of the coolest API features into one wrapper.
With our NASA API package, you can call the API right in your browser, then export the code snippet in the language of your choice. If you’re feeling impatient to get coding, check it out for yourself. Otherwise, here is a list of some of its functionalities:
- Get a picture of the day with a description from a NASA astronomer with the
- Hear sounds from space with the
- Retrieve images from the Mars Rover
- Find and track asteroids based on your location, a date in time or more
- Pull NASA patents by category
- Return NASA imagery of Earth by location
- Track natural events (ex. storms) with NASA’s EONET (Earth Observatory Natural Event Tracker)
These endpoints and functionalities are from multiple NASA APIs, but we put them all in one place.
How to call the NASA API
One of the things we love about NASA’s API is how open it is. Most of its functions don’t even require an API key. If you do want to use a function requiring an API key, just apply with a name and email here.
Today, we’ll call the
getPictureOfTheDay endpoint. The Astronomy Picture of the Day (or APOD) is one of NASA’s most popular public API calls. In fact, NASA’s website displaying the APOD is consistently one of the most popular website in the federal government, with 3.5 million views a month.
getPictureOfTheDay link, then “Test Function” to make a call to see the picture of the day for today’s date.
getPictureOfTheDay endpoint can generate a picture going back to June 16,1995, but defaults to today. To call a different date, fill in the YYYY-MM-DD in the date function of the optional parameters (we liked the picture on 1999-12-31).
Go ahead and test the call with the date of your birthday this year.
Why we love the NASA API
We’ll be honest, NASA’s API is hard not to love. We love that it’s all about space. We love that many functions don’t require an API key. We love the nerdy things it lets us track, like asteroids and Mars Rover pictures.
But what we love MOST of all is NASA’s commitment to open source. It’s not surprising that NASA has a ton of data available for the public. In 2013, there was an executive order (Project Open Data) launched to make more government data machine-readable and open to the public. What is remarkable however, is NASA’s commitment to open source projects and soliciting developer participation. You can read more about their open source initiatives (and how to get involved) here or by following @openNASA.
Hungry to play with the NASA API? Use RapidAPI to connect to multiple APIs to build projects. Here are some script ideas:
- Connect with the Twilio API to text the nearest asteroid to you
- Pair with the Twitter API to tweet the space picture of the day or shots from the Mars Rover
- Use the Google Geocoding API to convert any address to latitude/longitude coordinates, then use the coordinates to pull pictures of that address
Tell us about any projects you build in the comments–we’d love to see what you build!
Want even more API profiles?
You’re in luck–we’ve got 12 days of them! Follow along on our blog, Facebook or Twitter to stay up to date. In the meantime, catch up by reading our profiles on Lob’s mail delivery API, GIPHY’s API, Square’s eCommerce API and the Postmates delivery API.