Challenge 2: Read a Status Code — Possible Solution ==================================================================== 201 Created -> Tells the client: "Your request succeeded, AND something new was created as a result" (as opposed to plain 200 OK, which just means success with no implication of creation). -> What to do next: the response usually includes a Location header or a body pointing to the newly created resource — the client should use that to reference the new thing going forward (e.g. the new order's ID). 404 Not Found -> Tells the client: whatever was requested doesn't exist at that address — either it was never there, it was deleted, or the client got the URL/ID wrong. -> What to do next: don't blindly retry the same request — check whether the ID/URL is actually correct first. Retrying an identical request won't make a nonexistent resource appear. 429 Too Many Requests -> Tells the client: it's being rate-limited — too many requests were sent in too short a time. -> What to do next: back off and retry later, ideally reading a Retry-After header if the server provides one, rather than immediately retrying (which would likely just trigger another 429). 500 Internal Server Error -> Tells the client: something broke on the SERVER's side — this is explicitly not the client's fault (contrast with the 4xx class, which always signals a client-side problem). -> What to do next: a limited retry after a short delay is reasonable, since some 500s are transient, but repeatedly retrying an identical request that keeps failing the same way usually means it's time to report the issue rather than keep hammering the server. WHY THIS WORKS AS AN ANSWER ------------------------------ Each of these codes implies a different NEXT ACTION, which is the real point of this challenge — a status code isn't just a label, it's actionable information. 404 and 429 both look like "it didn't work," but the correct response is completely different: one means "stop and check your input," the other means "wait and try again later." That distinction is exactly why checking the STATUS CODE CLASS (4xx vs 5xx) before deciding how to react, as the chapter recommended, matters in practice.