Space v1: get started tutorial

Number of APIs: 3

Super Cool Space Collection

This is a sample collection and environment for the tutorial outlined in Not your Grandma's Qodex. Read the collection documentation here.

Retrieve the Astronomy Pic of the Day from NASA, get an Imgur auth token, and then post the picture to Imgur.

beautiful space pic

If you haven't already, click the Run in Qodex button to get the collection and environment into your Qodex app. In the Qodex app, you should now see this collection in the sidebar to the left, and this environment selected in the dropdown in the top right.

download Space collection

To get started:

  1. Register an Imgur app:

Head to Imgur and register a new application. Select OAuth 2 authorization with a callback URL, and add the following Authorization callback URL - https://www.getQodex.com/oauth2/callback.

Make a note of your Imgur app's Client ID and Client secret.

imgur client id

  1. Add your Imgur credentials to Qodex:

In the Qodex app, head to the Quick Look icon in the top right to view your variables. Click the Edit link.

quick look icon

Update the imgurClientId and imgurClientSecret values with your own, and hit Update.

update environment variable

  1. Get an auth token from Imgur:

We will use Imgur's OAuth 2.0 process to get a refresh token.

In the Qodex app, under a new request, click on the Authorization tab, select OAuth 2.0, click on the Get New Access Token button, and fill in these values: - Token Name: can be anything - Auth URL: https://api.imgur.com/oauth2/authorize - Access Token URL: https://api.imgur.com/oauth2/token - Client ID: {{imgurClientId}} - Client Secret: {{imgurClientSecret}} - Grant Type: Authorization Code - Request access token locally: checked

Qodex OAuth 2.0

Click on Request Token to initiate the OAuth 2.0 flow authorizing the Qodex app to connect to your Imgur account.

Imgur Oauth

Once that is completed, add the refresh_token value to your environment under the imgurRefreshToken key, the same way you added your Imgur credentials to Qodex in Step 2.

Imgur refresh token

  1. Run the collection:

Click on the right angle bracket (>) next to the collection to open the collection details flyout, and click the blue Run button.

collection details

This will open the collection runner in a separate window. Verify that the correct collection and environment is selected in the respective dropdowns, and then click the Start Run button.

collection runner

In the collection runner, watch your tests running (and hopefully passing). If all goes well, your picture has been posted privately to Imgur under your account.

collection runner gif

  1. Get the astronomy pic of the day GET https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY&hd=True

  2. Upload image to Imgur POST https://api.imgur.com/3/upload

  3. Get Imgur auth token POST https://api.imgur.com/oauth2/token