Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Let's revisit the GET /orders/1234 API again. It was previously suggested that the resource might include a link to cancel the order. In order for HATEOAS to work as intended, the server needed to verify that order #1234 was capable of being cancelled. This could rely on a number of factors, such as permissions of the user, whether the product was already shipped, or terms and conditions of this order. In all cases, the server returns or withholds the link (hypermedia) order cancellation link as needed.

In Summary

HATEOAS is an important design element of APIs that contributes to the uniform interface constraint of REST. However, HATEOAS will be underutilized if the clients aren't programmed to expect and utilize hypermedia content. In these cases, RESTful APIs are not much more than ways to access status resource content. Therefore, in order for HATEOAS to be worthwhile, both clients and servers need to support hypermedia content and rely on it to make state changes in the resource.