REST 00:00:01 What can a client safely repeat? A ticket app reads a seat, updates a profile and creates a payment. All use HTTP, yet their retry behavior should differ. The method communicates part of each operation's contract. GET is defined as safe and idempotent. Whether a response can be reused by a cache depends on its caching rules. POST does not carry a general idempotence guarantee. Two creation requests can create two orders unless the operation adds its own repeat protection. It replaces the whole resource, so the second call writes the same thing again. PATCH can be idempotent when it sets a field to a particular value. Other patch operations, such as appending another item, can change the result on each repeat. After one call or five, the resource is gone. The second answer may be 404. Idempotence concerns the intended effect of a repeated request. The response status, access log and time of processing can still differ on the next attempt. 00:01:00 Revalidate a seat representation The customer wants the latest representation of seat twelve. A fresh eligible cached copy can save a round trip to the service. Otherwise a validator can reduce the cost of checking whether anything changed. The client sends GET /seats/12. A copy that is still fresh is returned from the CDN at once. No fresh copy. The gateway verifies the token and the rate limit, then picks a server. Server 2 finds the answer in the shared cache. Server 1 would have found the same. The client had sent If-None-Match with the current ETag. The server answers 304 with no body. With a matching ETag on an appropriate conditional GET, a not-modified response lets the client reuse its stored body. Authentication and shared-cache eligibility still have to protect the customer's data. 00:01:50 Two editors cannot both own version seven Asha and Lee load the same profile before either saves. Asha commits first. Lee's intended edit might be fine, but her original representation can still erase what Asha changed. Asha and Lee each get the profile with ETag v7. PUT with If-Match v7. One row matches, so the update runs and the version becomes 8. PUT with If-Match v7. No row has version 7 any more, so nothing is written. Lee gets v8, sees Asha's change, adds their own and saves with If-Match v8. Put the precondition on the write itself. A failed match tells Lee to reread and reconcile. A separate read immediately before an unconditional update would leave a race. 00:02:35 The payment reply vanishes in a tunnel A buyer presses Pay once and the phone loses signal before it can see the response. The client now has an unknown outcome. Stable idempotency keys give the server evidence for recognizing the same logical attempt. The phone makes key k1 and sends POST /payments. Key and payment are saved together. The phone goes through a tunnel. It does not know whether the payment happened. The phone sends the same request with k1. The key is found, so nothing is charged. The stored 201 for payment 55 comes back. Scope the key to the caller and operation, verify matching request content and store the outcome durably. Define how long repeat protection lasts and make any external charging step honor the same business identity. 00:03:29 Assemble one screen from four resources One screen needs a user, reviews and two other resources. Measure independent fetches, conditional caching and an aggregate representation against actual network time and update patterns. The server decides each shape, so the screen asks four times. Independent requests can overlap over an HTTP/2 connection. The slowest dependency can dominate the wait, with scheduling and contention adding overhead. User and reviews are still fresh at the CDN. Two requests are left. An aggregate resource such as /profile-screen/7 gathers all four on the server. If every screen needs a different mix, weigh GraphQL. The useful interface makes identity, versioning, caching and retry semantics visible. Choose the number of resources after deciding what each representation means to its callers.