Testing an Apigee API Proxy

45 minutes
  • 4 Learning Objectives

About this Hands-on Lab

Developing an API proxy is similar to developing any other kind of software in that testing is required throughout its lifecycle. As you add policies or otherwise change the proxy code, you always have to ensure that you’re getting the desired results. Apigee has a robust mechanism that shows you what’s happening every step of the way: Trace, Apigee’s built-in visual debugger. In this hands-on lab, we’ll run a previously built API proxy through its paces, and we’ll examine the data revealed in order to troubleshoot an issue.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Open the API Proxy
  1. From the Apigee dashboard, choose API Proxies.
  2. Select the LA-Weather proxy.
Execute a Trace Session
  1. Select the Trace tab.
  2. In the URL field, add the following query parameters to API proxy URI:
    ?q=london,uk&appid=[YOUR_OPENWEATHERMAP_API_KEY]
    If you do not have a OpenWeatherMap API key, use fd4698c940c6d1da602a70ac34f0b147.
  3. Click Start Trace Session.
  4. Click Send.
Debug the Results
  1. Note the 404 error status returned by the API.
  2. Select the various icons to review the output in the Phase Details area.
  3. Note the properties of the Condition where the expression result is False.
  4. Click Stop Trace Session.
  5. In the URL, add /weather before the question mark for the query parameters.
  6. Click Start Trace Session.
  7. Click Send.
  8. Note the properties of the Condition and the output.
  9. Select the Develop tab.
  10. Under the Target Endpoint element in the Navigator, select default.
  11. In the Code area, change the HTTPTargetConnection URL to:
    https://api.openweathermap.org/data/2.5/weather
  12. Click Save.
Test the Modification
  1. Select the Trace tab.
  2. If it exists, remove the previously inserted /weather from the URL.
  3. Click Start Trace Session.
  4. Click Send.
  5. Note the 200 status in the Transactions area and the JSON response in the Response Content section of the Phase Details area.
  6. Click Stop Trace Session.

Additional Resources

There seems to be a problem getting the initial implementation of the LA-Weather API proxy to work properly. You've been asked to debug the proxy using Apigee's built-in visual debugger, Trace.

You’ll need to accomplish the following steps to complete your task:

  1. Open the API Proxy.
  2. Start a Trace session.
  3. Review the results.
  4. Debug.
  5. Repeat the Trace session.

Please note: There are several prerequisites for this hands-on lab:

  1. You must have an Apigee account.
  2. You must have completed the hands-on lab, Crafting an Apigee OpenAPI Spec, and successfully created the LA-Weather proxy with the lab Building an API Proxy with Apigee Edge.
  3. Optionally, you should have registered for an API key with OpenWeathermap.org.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?