This blog post is a no-nonsense guide to acquire a Request Trace in Azure API Management. A Request Trace is a JSON document that contains valuable information about a request/response sent to API’s exposed through Azure API Management. You can use the Request Trace for debugging and troubleshooting your APIs.
You need to Allow tracing in your API subscriptions in order to obtain a request trace.
Request traces might contain confidential information (like API keys and tokens), so handle your request traces with care.
You can obtain the Request Trace in two easy steps.
Add this header to your HTTP request:
Ocp-Apim-Trace: true
Your HTTP response now contains a response header called Ocp-Apim-Trace-Location:
Ocp-Apim-Trace-Location: https://apimXXXYYYZZZ.blob.core.windows.net/apiinspectorcontainer/XXXYYYZXZZThe value of this header is the URL to the actual Request Trace.
A request trace is a JSON document that consists of trace-information collected through an API request. This JSON document is divided into ‘request trace sections’ and ‘request trace log entries’.
Request trace sections (sometimes also referred to as policy sections): “inbound”, “backend”, and “output”.
Each ‘request trace section’ contains an array of ‘request trace log entries’.
Each log entry contains:
21
Azure API Management news at Ignite 2021: Event Grid, GraphQL and WebSockets
AZURE NEWS: Azure API Management Premium tier price reduction for incremental purchased units
BUILD 2021 NEWS: “Native support for WebSocket APIs in Azure API Management”
Azure API Management updates – October 2020
Working with HTTP errors in PowerShell