Press enter to see results or esc to cancel.

NASA API Profile: Explore the Cosmos with Code

Welcome back to #12DaysOfAPIs! Today, we’re blasting off with the NASA API.

screen-shot-2016-12-27-at-9-56-12-am

What you can do with the NASA API

We can pretty all much agree, space is awesome.

space-cloud
Spaaaaaace.

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 getPictureOfTheDay endpoint
  • Hear sounds from space with the getSpaceSounds endpoint
  • 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.

Click the getPictureOfTheDay link, then “Test Function” to make a call to see the picture of the day for today’s date.

nasa-picture-call-gif

The 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).

nasa-12-31-1999

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.

mars-curiousity
Mars Curiosity Rover coming in for landing!

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.

Project ideas

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.

Comments

Leave a Comment

Tell us your thoughts!

Spread the API ❤️