api-design

  • A circuit breaker before the third-party outage

    A payment provider was slow and the whole site went down with it. A timeout bounds one request; it does nothing about how many are waiting at once.

  • Event versioning is harder than API versioning

    An API version can be retired once the clients have moved. An event may be sitting in a queue, or in an event store, published by a version…

  • Retry only what is safe to retry

    A retry policy applied at the HTTP client level retries everything, including the POST that succeeded and whose response was lost. The safety of a retry is a…

  • Designing an API two mobile clients can live with

    Two apps, two release cycles, and neither can be forced to update. What is additive, what is not, and the decisions that have to be made before the…

  • Custom endpoints belong in a namespace you own

    Registering a route under wp/v2 puts it in core’s namespace, where a future core route can collide with it and where nothing signals that it is yours. The…

  • A timeout is not a concurrency limit

    Setting a five-second timeout on a slow dependency feels like protection and is not: with twelve PHP-FPM workers and a dependency taking five seconds, twelve concurrent requests occupy…

  • A circuit breaker has three states and people implement two

    Closed and open are obvious: pass through, or fail fast. The third state is what makes it a breaker rather than a switch — half-open lets exactly one…

  • An event-driven seam between two services

    The synchronous call between two services was the reason both were down. Publishing an event decouples their availability — and makes eventual consistency a business decision.

  • REST API schema is not documentation, it is validation

    The schema attached to a route looks like a description for humans. Core uses it to validate and sanitise the request before the callback runs, which means an…

  • Deep pagination is the wrong shape of question

    from=10000&size=10 makes every shard produce 10,010 hits and the coordinating node sort 50,050 of them to return ten. The cost grows with the offset, which is why there…