What to do when your third party API fails:
- Circuit breaker design pattern: Check if the resource if available so your program does not crash if it does fail. FAIL FAST.
- Show cached content.
- Check for timeouts: Let the user know to try again later or wait for a few more minutes. Prevent them from refreshing the form and putting in more requests. Mark the necessary resources as unavailable.
- Fail gracefully and store any user-data to temporary storage.
- Validate the input data
- Network retries.
- Test the APIs continuously and monitor them. Keep calling the API and check if you get the right results.
- Rate limiting
- API virtualization (for testing, saves cost)
- synthetic / real-user monitoring
- asynchronous scripting
- Self hosting scripts
References:
- https://doc.akka.io/docs/akka/current/common/circuitbreaker.html
- https://netflixtechblog.com/fault-tolerance-in-a-high-volume-distributed-system-91ab4faae74a