How to read the API error message from Azure APIM using the qusto query hit from c# code in Rest API

36 views Asked by At

We have setup Azure App insights(APIM) for the API logs tracking. In logs we are storing API url,API request payload,API response message,API response error code.
Now I need to create one api which will read the error log messages in APIM and return API error message in response.

From API we will hit a Qusto query which will fetch all the APIM logs and then those logs should be returned in the above api with the following response:

{
    "Id": "1",
    "ApiUrl": "https://pd.myweb/user/{resource_id}?userId=SAM",
    "ApiErrormessage": "User SAM does not have access to the resource 1100"
}

I am expecting to create a Get API in dotnet core using c# which will return the response as below: Get: fetch/logs

Response:

{
    "Id": "1",
    "ApiUrl": "https://pd.myweb/user/{resource_id}?userId=SAM",
    "ApiErrormessage": "User sam does not have access to the resource 1100"
}
0

There are 0 answers