HATEOAS as a State Machine

Hypermedia and State

HATEOAS becomes especially powerful when resources have states.

For example, an order might transition from pending to paid, shipped, and delivered. A pending order may expose a pay link, while a shipped order should not expose a cancellation operation if cancellation is no longer legal.

The server controls which transitions are available based on current state, user permissions, and business rules.

This makes the API representation a discoverable description of the client's next possible actions.

Order State Machine