Step 10 - Test the API 2.0 as a Dev API

Test API Version 2 with Postman

  1. Login to the Developer Portal as dev1 (password dev1) - if the cookie is still there, authentication will be transparent (thanks to OIDC)

  2. Click on App Credentials and click your organization (nginx)

  3. Click Create Credential

  4. Use sentence2 for the App name, and select sentence-api v2 for the API.

    ../../../_images/cred-v2.png
  5. Copy the new Key and open Postman

  6. Select GET Colors, add your API key in Authorization, and send the Request

    Note

    Request fails with a 403 response code.

    ../../../_images/colors-403.png

    Note

    As you can notice, as /colors is not part of the v1, the API Gateway denied the request. The URI path needs to be corrected. It must be /v2/api/

  7. While in Postman, modify the request to http://api.sentence.com/v2/api/colors and send it -> it passes

    ../../../_images/colors-ok.png
  8. Let’s try to send a request to /animals from version 1

    Note

    It works because the gateway knows, thanks to the /v1 or /v2 prefixes, which API Proxy to use. You can try to change /animals to v2. It will work as this endpoint also exists in v2. Be sure to utilize the correct API Key in the Postman authorization. If you did not test with the /animals endpoint earlier in the lab, you will need to add the API key for authorization.

Test API Version 2 with Dev Portal

  1. In Developer Portal, re-login (refresh the browser first)

  2. Go to APIs doc, and select v2

  3. Select GET /colors endpoint, and try it out

  4. Select the sentence2 credential and send the request

    ../../../_images/devportal-v2.png

Note

In this lab, we saw how to update an existing API Proxy with a new version and how the gateway behaves with different versions up and running