Integrating Third-Party APIs
Explore how to read an API contract before writing a client, covering pagination, error meanings, rate limits, and write guarantees. Understand how to classify failures, bound retries, and use stable idempotency keys so a lost response never creates a duplicate, preparing you to build integrations that fail safely.
The service creates review batch B70, but the response is lost before reaching the client. The client times out while waiting for the response. The service committed the batch, but the client cannot determine whether the operation succeeded because it received no response. Retrying the request could return the existing result or create a duplicate batch, depending on the service's idempotency guarantees.
Build reliable integrations by validating requests and responses against the API contract, limiting retry attempts, and verifying whether operations are safe to repeat. A generic retry decorator cannot determine whether repeating a request will cause unintended side effects.
Defining the integration goal
A support manager needs one review batch containing every open case in a fixed snapshot. The assignment has two steps:
Retrieve all open cases from snapshot snap-17.
Create one review batch containing their IDs.
A successful HTTP response satisfies neither step on its own. An incomplete export could omit a case; a repeated create could assign the same work twice. Unlike a local file ...