Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to build a Hypermedia-Driven REST API - Notes

Finishing Our First Movies API

Does it the "wrong" way so we can learn why the "right" way maybe better.

Builds an "RPC style" API which in this case means that all requests will come in the form of POST requests and all responses would be returned in the body.

Tools

REST Level 1 - Resources as Nouns

The current "RPC style" API works but it is:

  • Messy
  • Hard to maintain
  • Not discoverable

New problems with the API after building a REST Level 1 version:

  • Not taking advantage of HTTP verbs, GET, POST, PUT, PATCH, DELETE etc
  • Not taking advantage of the HTTP status codes, return 200 OK for everything including errors

Resources

REST Level 3: Hypermedia-Driven Relationships

Hypermedia As The Engine Of Application State

... we're using links as ways of getting around applications and saving state. But you don't have to know how to make those URLs. Each time you get a response from the server it will have with it all of the available locations that you can get to from the spot you're in and so it creates a map through your application.

Resources

Steve Klabnik Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.