Get the astronomy pic of the day

GET https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY&hd=True

GET request for Astronomy Picture of the Day from NASA

Sending this request will return a picture posted by NASA. Review documentation for the NASA API.

Start in the Qodex request builder.

  • Method: Select GET from the dropdown menu of HTTP methods.

  • URL: Enter the URL endpoint provided by NASA - https://api.nasa.gov/planetary/apod

  • Parameters: This request will work without any additional parameters, and default to using NASA's demo key. However, we can choose to add query string parameters to our request. Click the Params button to reveal a key-value editor. As you input parameters, they are automatically added to the query string in the URL bar above.

Under the Qodex Tests tab, we can write scripts in JavaScript to execute any logic after the request is sent.

Qodex tests are a good way to ensure that you're getting the correct, anticipated responses from your requests. You can include custom scripts to execute additional logic too.

tests tab

  • Under the Qodex Tests tab, the first test ensures a successful 200 response status code.
  • The second test will parse the JSON response object, and set environment variables (title, URL, etc.) that can be accessed in subsequent requests when the entire collection is run.
  • The third bit of code controls the workflow sequence and designates which request in the same collection to run next, instead of the next request in the list.

Read more about writing tests and controlling the workflow in the Qodex docs.

Request Params

KeyDatatypeRequiredDescription
api_keystring
hdstring

RESPONSES

status: OK

{"copyright":"Göran Strand","date":"2017-04-13","explanation":"On April 10, a Full Moon and Jupiter shared this telephoto field of view. Both were near opposition, opposite the Sun in Earth's night sky. Captured when a passing cloud bank dimmmed the bright moonlight, the single exposure reveals the familiar face of our fair planet's own large natural satellite, along with a line up of the ruling gas giant's four Galilean moons. Labeled top to bottom, the tiny pinpricks of light above bright Jupiter are Callisto, Europa, Ganymede, and Io. Closer and brighter, our own natural satellite appears to loom large. But Callisto, Ganymede, and Io are physically larger than Earth's Moon, while water world Europa is only slightly smaller.  In fact, of the Solar System's six largest planetary satellites, only Saturn's moon Titan is missing from the scene.","hdurl":"https://apod.nasa.gov/apod/image/1704/GS_20170410_MoonJupiter_7435.jpg","media_type":"image","service_version":"v1","title":"Moons and Jupiter","url":"https://apod.nasa.gov/apod/image/1704/GS_20170410_MoonJupiter_7435px1024.jpg"}