question

suvrajyoti-2505 avatar image
0 Votes"
suvrajyoti-2505 asked suvrajyoti-2505 commented

Get request details for an api call in Azure APIM using the requestId

Hi All,

I am working on monetization of API usage in Azure APIM for APIs we have published for customers to consume. I have a requirement to get usage details of API having columns API Id, SubscriptionId and AccountNo. Using the https://docs.microsoft.com/en-us/rest/api/apimanagement/2019-12-01/reports/listbyrequest i am getting all column values except the AcountNo. But the response gives me the requestId as below. Can i get the request header/body information using the requestId or is there any other way i can fetch the details of the actual call/request that was made for an api. Thanks in advance.

{
"value": [
{
"apiId": "/apis/5931a75ae4bbd512a88c680b",
"operationId": "/apis/5931a75ae4bbd512a88c680b/operations/-",
"productId": "/products/-",
"userId": "/users/1",
"method": "GET",
"url": "https://apimService1.azure-api.net/echo/resource?param1=sample",
"ipAddress": "207.xx.155.xx",
"responseCode": 404,
"responseSize": 405,
"timestamp": "2017-06-03T00:17:00.1649134Z",
"cache": "none",
"apiTime": 221.1544,
"serviceTime": 0,
"apiRegion": "East Asia",
"subscriptionId": "/subscriptions/5600b59475ff190048070002",
"requestId": "63e7119c-26aa-433c-96d7-f6f3267ff52f",
"requestSize": 0
},
{
"apiId": "/apis/5931a75ae4bbd512a88c680b",
"operationId": "/apis/5931a75ae4bbd512a88c680b/operations/-",
"productId": "/products/-",
"userId": "/users/1",
"method": "POST",
"url": "https://apimService1.azure-api.net/echo/resource",
"ipAddress": "207.xx.155.xx",
"responseCode": 404,
"responseSize": 403,
"timestamp": "2017-06-03T00:17:20.5255131Z",
"cache": "none",
"apiTime": 6.6754000000000007,
"serviceTime": 0,
"apiRegion": "East Asia",
"subscriptionId": "/subscriptions/5600b59475ff190048070002",
"requestId": "e581b7f7-c9ec-4fc6-8ab9-3855d9b00b04",
"requestSize": 0
}
],
"count": 2
}

The AccountNo is getting set in the Request Header/Request Body.


azure-api-management
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

PramodValavala-MSFT avatar image
0 Votes"
PramodValavala-MSFT answered suvrajyoti-2505 commented

@suvrajyoti-2505 This API is tailored to provide metrics on requests rather than serve as logging of the complete requests themselves. To log the requests themselves, you could send them to

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks Pramod. I cannot use the same the Event Hub and App Insights at this point tough.

0 Votes 0 ·