Home > other >  Retrying failed API requests
Retrying failed API requests

Time:11-08

I have an API request re-retry interceptor that I've implemented to re-try failed API calls. currently, it retries all the failed API calls. The question is what kind of failed requests should not be retried? for example, an API that returned a 403 HTTP status code should not be re-tried. responses that have HTTP status codes starting with 2 should not also be retried because they already have returned the data.

CodePudding user response:

You can read a short list of status codes here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status 3xx is redirected, it should be checked why the redirection happens, so probably better not to retry 4xx should not be retried, because something is wrong with the request. 5xx can be retried, because something is wrong with the server, though better to wait a few mins with it.

  • Related