Challenge 3: Add HATEOAS Links — Possible Solution ==================================================================== { "id": 55, "status": "shipped", "links": { "self": "/orders/55", "track": "/orders/55/tracking", "invoice": "/orders/55/invoice", "return": "/orders/55/return" } } WHY THESE LINKS MAKE SENSE ------------------------------ Given the order's current status is "shipped," the plausible next actions for a client are things you'd actually want to do with a shipped order: - "self" — a standard link back to the resource itself, present on almost every HATEOAS response regardless of state. - "track" — since it's shipped, tracking its delivery is an obvious next action. - "invoice" — retrieving the invoice/receipt is a common related action for any completed order. - "return" — a shipped order can plausibly be returned once received, so surfacing that link lets the client discover this capability without hard-coding it. Note what's intentionally NOT included: a "cancel" link. Once an order has already shipped, cancelling it outright typically isn't a valid action anymore (a return would be the correct path instead) — a well-designed hypermedia response reflects the resource's CURRENT state by only including links for actions that are actually valid right now, not a fixed list of every action that could ever apply to an order at any status. WHY THIS WORKS AS AN ANSWER ------------------------------ The point of HATEOAS isn't just "add some links" — it's that the set of links included should change based on the resource's actual state, so the response itself communicates what's possible next without the client needing to already know (or guess) the business rules around when each action is valid.