Re-trying failed requests using APIM

Maksymilian Rebrii 31 Reputation points
2022-10-27T10:18:49.347+00:00

I need to implement re-trying failed requests manually. Is there any mechanisms already implemented in APIM? Or there is only one way - get failed requests by status, transform them to a new requests and re-send manually?

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
{count} votes

Answer accepted by question author
  1. MuthuKumaranMurugaachari-MSFT 22,446 Reputation points Moderator
    2022-10-31T15:45:24.483+00:00

    @Maksymilian Rebrii Unfortunately, there is no built-in functionality in APIM to perform retry asynchronously.

    When retry policy is in place, the client makes a request and APIM tries x times with y duration until z condition is met and the client needs to wait till the above is executed. I understand this wouldn't fit your scenario.

    For asynchronous call, you can use send-one-way-request policy (Send one way request docs) to send a request to external services without waiting for a response. This way you can send failure events (or based on some conditions) to your custom solution/endpoint where you can implement the retry mechanism. Refer docs: Using external services from the Azure API Management service describing this policy.

    Regarding your other question, if you have integrated APIM with App Insights like https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-app-insights, then you can use Query - Get to pull the data from the table (Try sample query in REST API docs: requests | where resultCode == 200 for your appId).

    255763-image.png

    Note, the above telemetry items are sent to Application Insights, and you can use portal to find requests, traces, exceptions as shown below (also get sample request generated from Developer Tools):

    255772-image.png

    AppRequests, AppTraces, AppExceptions are for Log Analytics endpoint (https://learn.microsoft.com/en-us/rest/api/loganalytics/dataaccess/query/get).

    I hope these answers would help with your questions and feel free to add a comment if you have any other questions. We would be happy to assist you. Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.