Send Docs Feedback

Part 3: Trace API calls

This is a legacy tutorial and is being rewritten to match the new API proxy sample shown in Create your first API proxy.

About the Trace tool

Use the Trace tool for troubleshooting and monitoring API proxies running on Apigee Edge. Trace lets you probe the details of each step through an API proxy flow, view the request and response objects, view response times, and more.  The Trace tool lets you review data on how a request changes as  it is processed by an API proxy. You can see how each policy is performing and how long it takes to execute. By examining the data during debugging, you can see exactly where any problems occur.

For more, see Using the Trace tool.

Prerequisites for this tutorial

This tutorial assumes that you have completed the first tutorial, where you create an API proxy to access the Yahoo weather API. If you have not yet completed that tutorial, see Create your first API proxy.

While it is not required, Apigee recommends that you also complete the policies tutorial before running the Trace tool. See Part 2: Add policies to your API.

Step 1: Execute and Trace API calls

Trace shows you data from a number of calls taken from live data. Send calls to your weather API to generate the trace data.

  1. In the management UI, click the APIs tab. If the API Platform page is not open, click here.

  2. Click weather in the API Proxies table.
  3. On the weather detail page, click the Trace button to access the Trace page.
  4. On the Trace page, choose the test environment. This will let you set up a trace session on the test environment.

  5. Click Start Trace Session.

    The trace session runs for 10 minutes. While the trace session is running, messages are captured from live traffic.

  6. Request your API directly from a Web browser by entering the following URL:



    • {org-name} is the name of your organization
    • {env} is the environment, which is either test or prod.

    For example:

    The processing time for each message appears in the Transactions section of the Trace page.

  7. Request the URL from the Trace page itself by entering the URL and clicking Send in the Send Requests section.

    You can click Send multiple times to generate as much traffic as you wish.

  8. Click the first transaction in the Transactions section.

    The response and request flows of your API call are shown graphically in the Transaction Map section (below the Send Requests section). Below the graphic you can see the request received by your API proxy from the client and the response sent to the client.
  9. Examine the request flow from client to the backend service, and then view the response from the backend service to the client. Click the Next button on the far-right of the window to step through the process.

    The first time you select Next you will see the request as it was sent to the Spike Arrest policy.
  10. Click Next until you see the response from the backend service.

    At each step you can examine the Phase Details to get more information. In this case, examine the Response Content section so you can see the forecast data that was sent back from the Yahoo weather service. Notice how it is formatted as XML.
  11. Click Next until you see the response from the XML to JSON policy. Notice that the Response Body now contains JSON data.
  12. If you added the Spike Arrest policy, continue to hit the Send button until you generate a rate limit violation.

    You will see an HTTP 500 error in the Transactions section of the Trace page. ​If you can't send requests quickly enough to get a 500 response, set the rate to 1pm in the Spike Arrest policy.
  13. The Trace tool has more options that you can try. For more, see Using the Trace tool.

Step 2: Where to next?

Apigee Edge collects information as data passes through it. The data includes API call information (URL, IP, and user ID) latency, errors, and so on. This data is gathered into trend charts and tables throughout the management UI. You can use this data to both monitor the overall health of your API program and the health of individual APIs.

Continue on to Part 4: Monitor your API's performance to learn about monitoring your API's performance.

Help or comments?