Skip to main content

Enable/Disable Retries per Endpoint for any HTTP Method

· 2 min read

By default, our SDKs support retries for idempotent HTTP requests only. A flag is added at endpoint level which, when enabled, allows retries for non-idempotent HTTP requests as well.

Details

Previously, the only way to retry non-idempotent HTTP methods was to add the HTTP methods that needed to be retried to the “Http methods to retry” list. This enabled SDK to retry for all the requests with the specified HTTP methods. While this covered handful of scenarios, there were cases where only certain endpoints needed to be retried regardless of their HTTP methods.

To address this, a Boolean setting forceRetries is introduced in x-operation-settings property defined per endpoint.

"paths": {
"/pets": {
"post": {
...
"operationId": "addPet",
"x-operation-settings": {
...
"forceRetries": true
}
}
}
}

When forceRetries is set to true, the SDKs can force retry an endpoint regardless of whether it is idempotent or not. If false, the endpoints will not be retried. By default, only idempotent endpoints are retried.

This is the behavior for all of the SDKs with the exception of Ruby where there is a slight deviation. At endpoint level, forceRetries with null and false values will have the same behavior i.e will not have any impact on the existing behavior of retries. In case of forceRetries being true, the endpoint with any http method will be retried irrespective of HTTPMethod allowlist.