Upgrade to Pro — share decks privately, control downloads, hide ads and more …

REST API Design, Part I

REST API Design, Part I

Given at PHP Undiscovered, SF.

Nate Abele

August 29, 2013
Tweet

More Decks by Nate Abele

Other Decks in Programming

Transcript

  1. Every time someone mentions RESTful web services, there’s always that

    one person that has to chime in: “That’s not really RESTful, it’s just kinda RESTful.” — Steve Klabnik
  2. THE RICHARDSON MATURITY MODEL • Level 0: RPC over HTTP

    • Level 1: Resources vs. single service endpoint • Level 2: HTTP Verbs vs. URL-based method calls • Level 3: Hypermedia controls
  3. MEANINGFUL RESPONSE CODES • 201: Created • 202: We’ll get

    back to you • 304: Use the copy I gave you last time • 400: WTF URL parameters • 401: Authentication • 403: Access control
  4. MEANINGFUL RESPONSE CODES • 406: I refuse to speak XML

    • 410: Soft deletes • 415: I refuse to listen to XML • 418: Useless, I wanted coffee • 422: Validation failed • 429: Chill out • 451: Legal told me not to • 503: Network/database/dependent service issues