APIs are meant to be used by developers, which means non-developers typically don’t get a chance to “directly access” the wealth of information provided by APIs. I faced a similar situation last week when I tried using a NASA API to observe our Earth via a satellite sitting a million miles far. The outcome: I did write some code, but ended up creating API docs for non-developers to see those gorgeous views without having to write any code.
Background
On November 20th, I was observing the recent lunar eclipse with my 9 years old via a telescope. That reminded me of another telescope at DSCOVR (Deep Space Climate Observatory) which captures our Earth from a million miles (details are coming below). These images are available via an API, but getting an image on a particular date required multiple API calls, and combining the images of a single day was not an option. Combined images help see a time-lapsed view of a whole day as well as give a side-by-side view of some rare occurrences such as the moving shadow of a solar eclipse, or the back-side of our moon in transition. Therefore, I wrote a small API on top of NASA’s API and published the relevant documentation of both the APIs.
Fasten Your Seat Belts, We’re Going Deep in Space
Hold tight as we’re going to see our beloved planet from some distance. You can start straight away by watching a past solar eclipse (hit the Try It Out button, and change the date for different eclipses). Since the telescope stays at a Lagrange point (L1), it can see the sun-lit part of the Earth 24/7. Therefore, in the case of a solar eclipse, it captures the shadow of the moon passing through different parts of our planet. The following picture depicts this scenario and became my motivation for doing this exercise.
A Lunar Transit
As you might have guessed, at a million miles away, we go well past the moon, so it gives us a chance to see the rear or dark side of the moon. Since the moon is phase-locked with Earth, we never see this side of the moon from Earth. However, thanks to DSCOVR, we can now see this spectacular view of the moon when it transits between the telescope and Earth. Try It Out via an API call.
Non-Developers – How’s Been The API Experience?
If you’re not a developer and have clicked the “Try It Out” button in either of the above links, then congratulations! You successfully called an API without writing any code. The left column of the API Portal acts as a menu to select getting started guides, API functions (also known as endpoints), and API models’ information. In the middle column (the API Code Playground) there are multiple settings to configure the output image including gridColumns
(to change the image grid) and imageQuality
. Any change in these settings is also reflected in the code on the right-most column. That’s how developers build sample application code based on their own input. If the code seems overwhelming, you may safely ignore it and hit the “Try It Out” button on the bottom right to immediately get the output.
Developers – It’s Simple yet Effective
You might have guessed already that the combined images are being generated via chaining a few endpoint requests to NASA’s EPIC API. The top 3 endpoints are from EPIC API, while I added the bottom 3 endpoints. Interestingly, all 3 of my endpoints are hitting the same function at the server, while I am tweaking the input at the API level using APIMatic’s editor. I could have made an app to display the combined images but opted for an API because the use case was simple enough to be directly used from the API docs. Moreover, there are SDKs and Code Samples available for all the endpoints, so that the API could be used in different applications.
EPIC “Blue Marble” API - What’s So Special?
The science behind Lagrange points is quite fascinating. Parking a space station right there, and continuously capturing the Earth's atmosphere makes EPIC API quite special. According to NASA :
- DSCOVR orbits about a million miles from Earth in a unique location called Lagrange point 1, which basically allows it to hover between the Sun and our planet.
- The EPIC API provides information on the daily imagery collected by DSCOVR's Earth Polychromatic Imaging Camera (EPIC) instrument. Uniquely positioned at the Earth-Sun Lagrange point, EPIC provides full disc imagery of the Earth and captures unique perspectives of certain astronomical events such as lunar transits using a 2048x2048 pixel CCD (Charge Coupled Device) detector coupled to a 30-cm aperture Cassegrain telescope.
Conclusions
APIs have opened up new doorways to exciting information. That information is not available to common people until developers build “apps” using the APIs. However, some of the APIs, especially the ones providing data, can be accessed by both developers and non-developers via purpose-built API docs. And if the API is as exciting as NASA’s EPIC API, then we should not keep the non-coders away from such a nice experience, especially in the booming no-code and low-code times.
Thanks for reading. Please feel free to reach out for any suggestions and feedback at adeel@apimatic.io.