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

What is Hypermedia API?

Marat
September 30, 2012

What is Hypermedia API?

Talk given on RubyShift 2012 in Kyiv September 29-30.

RoR did a great thing to make REST popular. Now it turns out that
original REST approach is not what we think REST is. But what it is
then? Hypermedia API is a new term which stands for original REST
approach. What is the difference between "REST" and Hypermedia API
(true REST)? What is Hypermedia? Why is it needed? These questions
are covered in my talk.

Marat

September 30, 2012
Tweet

Other Decks in Programming

Transcript

  1. Servers SHOULD return a response code of 204 if the

    HTTP DELETE request was successful.
  2. Document MAY contain a single filters object. Five properties: href(REQUIRED),

    rel (REQUIRED), name (OPTIONAL), prompt (OPTIONAL), and a data array (OPTIONAL)
  3. <root> <id>q0</id> <link rel = "q1" uri = "..." />

    <link rel = "q2" uri = "..." /> </entry> <root> <id>q1</id> <link rel = "q0" uri = "..." /> <link rel = "q3" uri = "..." /> </entry>
  4. 100 Continue 201 Created 202 Accepted 206 Partial Content 303

    See Other 400 Bad Request 401 Unauthorized 404 Not Found 409 Conflict 412 Precondition Failed 417 Expectation Failed
  5. 100 Continue 201 Created 202 Accepted 206 Partial Content 303

    See Other 400 Bad Request 401 Unauthorized 404 Not Found 409 Conflict 412 Precondition Failed 417 Expectation Failed
  6. 100 Continue 201 Created 202 Accepted 206 Partial Content 303

    See Other 400 Bad Request 401 Unauthorized 404 Not Found 409 Conflict 412 Precondition Failed 417 Expectation Failed
  7. 100 Continue 201 Created 202 Accepted 206 Partial Content 303

    See Other 400 Bad Request 401 Unauthorized 404 Not Found 409 Conflict 412 Precondition Failed 417 Expectation Failed
  8. 100 Continue 201 Created 202 Accepted 206 Partial Content 303

    See Other 400 Bad Request 401 Unauthorized 404 Not Found 409 Conflict 412 Precondition Failed 417 Expectation Failed
  9. 100 Continue 201 Created 202 Accepted 206 Partial Content 303

    See Other 400 Bad Request 401 Unauthorized 404 Not Found 409 Conflict 412 Precondition Failed 417 Expectation Failed
  10. GET https://api.github.com/gists/1 Accept: application/json 200 OK ETag: "2259b5bea67655550030acf98bad4184" {body} GET

    https://api.github.com/gists/1 Accept: application/json If-None-Match: "2259b5bea67655550030acf98bad4184" 304 Not Modified
  11. 1. “The Swamp of POX.” You’re using HTTP to make

    RPC calls. HTTP is only really used as a tunnel. http://api.example.com?post_id=1&user_id=2
  12. 2. Resources. Rather than making every call to a service

    endpoint, you have multiple endpoints. http://api.example.com/posts/edit/1 http://api.example.com/users/show/1
  13. 4. Hypermedia Controls. HATEOAS. You’re 100% REST compliant. GET https://api.example.com/

    HTTP 1.1 Accept: application/vnd.example-v1+json If-Match: “...” Authentication: ... 200 OK {root: {entries: ...}, links: [{rel: “edit”, url: “...”}, {…}]}