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

Basic REST Concepts

Basic REST Concepts

Avatar for Roberto Guerra

Roberto Guerra

August 09, 2013

More Decks by Roberto Guerra

Other Decks in Technology

Transcript

  1. Go Watch ! Hypermedia APIs by Jon Moore http:// vimeo.com/20781278

    ! Building Restful APIs, and how learning the word hypermedia will make you look smarter - Sebastien Lambla http://vimeo.com/37936696
  2. Resources - Examples ! A movie ! A bank account

    ! A purchase order ! A time entry
  3. URI ! In a RESTful web service a URI is

    a hyperlink to a resource.
  4. URI ! The only means to exchange representations of resources.

    ! /user?id=29123 ! /employee/007/vacations
  5. URI ! Used to link resources together {name: “Jon Doe”,

    rel: [ {self: ‘http://a.domain.com/user/4123’}, {address: ‘http://a.domain.com/address9823’} ]}
  6. Representations ! Different clients can consume different representations of the

    same resource. ! Resource must be available through the same URL.
  7. POST : Status ! 201 - Created ! 200 (OK)

    ! 204 (No Content) ! 202 (Accepted - processing not completed)
  8. PUT : Status ! 201 - Created ! 200 -

    OK ! 204 (No Content)
  9. DELETE : Status ! 200 (OK - Response Includes entity)

    ! 202 (Accepted - Will process later) ! 204 (No Content - No entity)
  10. HTTP Status Codes ! 1xx informational messages ! 2xx success

    messages ! 3xx redirects client to another URL ! 4xx client-side error ! 5xx server-side error ! http://www.w3.org/Protocols/rfc2616/rfc2616- sec10.html