22
Views
6
Comments
API retry attempts
Question

Hi All,

Can anyone suggest below requirement how to approach,

API Retry Functionality 


The API Retry Functionality is designed to ensure reliable and orderly communication with the exte system, even in the presence of transient errors. Its primary goal is to detect errors during the sending of an API call chain, trigger targeted retries and preserve the correct execution sequence. This approach prevents unnecessary duplication and maintains data integrity. 

Requirements and Logic 

Error Detection: Monitor each API call in the chain for negative responses or failures. 

Order Preservation: Always send API calls in the precise order defined in the previous section to respect entity dependencies. 

Targeted Retry: If an API call fails, retry only from that specific call rather than resending the entire chain. 

Chain Pause and Resume: Upon a failed call, pause the sequence. Resume from the failed point once the retry succeeds. 


User Notification: If repeated retries fail, display the message: "An application error occurred, please contact XXXX." 

Additional Insights 

Implementing exponential backoff for retries can help prevent overwhelming the ext system during outages. Logging all errors and retry attempts is recommended for troubleshooting and audit purposes. Adjustable retry limits should be configurable based on system requirements. 

Regards



2025-12-22 13-50-43
Sherif El-Habibi
Champion

Hello @Preeti zade,

I think you can find most of the answers to these questions by implementing Distributed Transaction pattern. You can watch a video explaining the concept here: Distributed Transactions Patterns

2024-07-12 05-57-50
Gourav Shrivastava
Champion

Hello @Preeti zade 

Suggested flow:

  • Store each API request in an entity with fields like:
    • IsProcessed
    • RetyCount
    • Status/ErrorMessage
  • The Timer processes records sequentially (inside a loop with IsProcessed = False).
  • If an API call succeeds, mark IsProcessed = True
  • If it fails:
    • increase RetryCount
    • store temporary error for debugging/logging
    • Stop processing the next calls in the chain and revoke the timer
  • Re-trigger the Timer to retry.
  • If RetryCount exceeds a limit (example: 5), mark it as final failure and show:
    "An application error occurred. Please contact XXXX."

This approach:

  • preserves order
  • retries only failed calls
  • avoids duplicate processing
  • provides proper logging/debugging 

NOTE:- Please follow best practices of timers, like timeout handling, for each record, checking if the timer is near its timeout 

UserImage.jpg
Preeti zade

Thank you Gourav for the reply,

It would be helpful if any sample with this approach is available,

Regards


2024-07-12 05-57-50
Gourav Shrivastava
Champion

Hello @Preeti zade 

I have made one sample use case for your reference 


Please find the attached OML and go to the APIrequests_Action server action

DataSync.oml
2024-07-12 05-57-50
Gourav Shrivastava
Champion

I have not implemented the maximum retry logic here. You can just add a small check on error flow that if the retry is  greater than 5, you can mark that record as IsProcessed = True with an error message 

UserImage.jpg
Preeti zade

Hello @Gourav Shrivastava 

Thank you

But all my apis are getting called on submission of some form in sequence so how I will call the failed apis and below you have mentioned to call api so intial logic should be there to call failed apis in timer?

I mean in my positive flow of submission of form if the api fails,do I need to add some logic that api failed and invoke only those apis from timer?

But if the apis are depends on each other then How I will use timer,can you clarify

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.