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

RESTの力 / The Power of REST

RESTの力 / The Power of REST

HTTPはRPCではなく、RESTはHTTP上のCRUDシステムではありません。RESTはハイパーメディアアフォーダンスという発見性を持ち、進化可能性(evolvability)、スケーラビリティ、自己記述性、といったアプリケーションをパワフルにする力を持ちます。

PHPカンファレンス大阪(2014)での基調講演「全てを結ぶ力」、翌年福岡での基調講演「全てを結ぶ力」に続く"全てを結ぶ力三部作"の完結編。

Akihito Koriyama

March 30, 2019
Tweet

More Decks by Akihito Koriyama

Other Decks in Technology

Transcript

  1. Information Management: A Proposal Tim Berners-Lee, CERN March 1989 WorldWideWeb:

    Proposal for a HyperText Project T. Berners-Lee/CN, R. Cailliau/ECP November 1990 https://www.w3.org/History/1989/proposal.html https://www.w3.org/Proposal.html
  2. wΫϥΠΞϯτʗαʔό wεςʔτϨεੑ wΩϟογϡ w֊૚ԽγεςϜ w ίʔυΦϯσϚϯυ  w౷ҰΠϯλϑΣʔεɹ ͭͷΠϯλʔϑΣΠε੍໿ʣ wϦιʔεͷࣝผ

    63*  wදݱʹΑΔϦιʔεૢ࡞ wࣗݾهड़తϝοηʔδ wϋΠύʔϝσΟΞ੍໿ )"5&0"4 3&45ʢ'JFMEJOHʣ੍໿ "38 https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
  3. l࠷ߴͷΞϓϦέʔγϣϯύϑΥʔϚϯε͸
 ωοτϫʔΫΛ࢖Θͳ͍࣌ʹಘΒΕΔz The best application performance is obtained by not

    using the network. https://www.ics.uci.edu/~fielding/pubs/dissertation/net_app_arch.htm
  4. • text/html (hypermedia) • application/json • application/hal+json (hypermedia)
 
 •

    application/problem+json • vnd.amundsen.maze+xml (OFSJD %PNBJOTQFDJpD
  5. $ curl -i http://example.com 
 HTTP/1.1 200 OK Content-Type: application/json

    Link: <http://example.com/profile>; rel="profile" { "wtl": "MjAxMy0wNS0wNiAxMjo1Nzo1MyAtMDcwMA==\n", “grobb34s": […] } $ curl -i http://example.com/profile
 HTTP/1.1 200 OK Content-Type: text/plain 
 The Example.com API =================== Example.com provides access to our blog through an API. In the API, you'll see two major things of interest: `wtl` and `grobb34s` ## wtl The value provided under the `wtl` key is the time the latest blog post was posted, in "%Y-%m-%d %H:%M:%S %z" format. This value is then Base64 encoded. http://www.designinghypermediaapis.com/blog/the-profile-link-relation-and-you.html
  6. HTTP/1.1 200 OK
 Content-Type: application/json
 Link: <http://example.com/todo.json>; rel="describedby" {
 "id":

    123,
 “title": “Shopping” 
 } https://json-schema.org/latest/json-schema-core.html
  7. UPEPKTPO {
 ”$id”: “http://example.com/todo.json",
 "$schema": "http://json-schema.org/draft-07/schema#",
 "title": "Todo",
 "type": "object",


    "properties": {
 "id": {
 "type": "type": "string",
 "description": "The unique identifier for todo."
 },
 "title": {
 "type": "string",
 "description": "The title of the todo",
 "minLength": 3,
 "maxLength": 255
 }
 }
  8. /BNJOH There are only two hard things in Computer Science:

    cache invalidation and naming things.
 -- Phil Karlton
  9. Credit: From Nelson, Computer Lib/Dream Machines (Courtesy of Theodor Holm

    Nelson) ͢΂͕ͯਂ͘ࡨ૰͍ͯ͠Δ https://link.springer.com/chapter/10.1007/978-3-319-16925-5_13