I ♥ NASA. You ♥ NASA. We all ♥ NASA.

So how can I use the images and things they expose in their APIs in Mathematica?


1 Answer 1


I built a ServiceConnect paclet for this (details on how I did this can be found at the end of this post).

You can access it like so:



(note that unless you have BTools installed and have loaded the PacletTools package (e.g. by just calling PacletUpload raw to get the autoloader to run) you won't get this formatted form)

Then just connect and have at it!

$so = ServiceConnect["NASA"]


Pic of the Day


nasa img


  "Date" -> Today - Quantity[1, "Weeks"], 
  "ImportImages" -> True,
  "ImportSelection" -> ;; 3
  ][All, {"Image", "caption"}]



  "earth_date" -> Today, "ImportImages" -> True, 
  "ImportSelection" -> {1}


And more!

You can get the currently supported requests like so:


{"APIKey", "Authentication", "EarthImages", "ID", \
"ImportEarthImages", "Information", "LandsatAssets", "LandsatImages", \
"MarsImage", "MarsRoverData", "Name", "NeoFeed", "NeoLookup", \
"Patents", "PictureOfTheDay", "RawRequests", "RequestData", \
"RequestParameters", "RoverCameras"}

And you can figure out what to pass to each using the "RequestParameters" like so:

$so["RequestParameters", "Request" -> "Patents"]

<|"Parameters" -> {"api_key", "query", "concept_tags", "limit"}, 
 "Required" -> {}|>

$so["Patents"]["results", 1, "title"]

"Selective functionalization of carbon nanotubes based upon distance  \

If you want me to implement more requests I can easily do so

Construction Process

I built this according to the process laid out in my answer to the question Creating a custom web API ServiceConnection.

The actual construction notebook can be obtained here so you can see what went into building it.

Essentially, I just have a template notebook that you fill out and which formats a call to the CustomServiceConnection function in my BTools package.

  • $\begingroup$ I love NASA⊙ Also. $\endgroup$
    – quintumnia
    Jan 14, 2018 at 17:03
  • 1
    $\begingroup$ +1 of course but please include at least the very initial implementation. We try to avoid link based answers as they can become useless once links are invalid. Would be also nice to link BTools if you mention them. $\endgroup$
    – Kuba
    Jan 15, 2018 at 6:19
  • $\begingroup$ @Kuba that's handled. I didn't go into the actual gory details but mostly just linked to a construction notebook and my previous answer on building ServiceConnections $\endgroup$
    – b3m2a1
    Jan 15, 2018 at 8:14
  • 1
    $\begingroup$ It is not about illumination but a self contained content. Once your wolfram cloud account is gone this answer won't be so helpful. $\endgroup$
    – Kuba
    Jan 15, 2018 at 8:46
  • 2
    $\begingroup$ @b3m2a1 You are right, it is not a must so let's stay with more example focused answers linked together with github and wpc. $\endgroup$
    – Kuba
    Jan 15, 2018 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.