RESTの力 / The Power of REST

RESTの力 / The Power of REST

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

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

Aad26cd7119bd8c0c2bbea107515716d?s=128

Akihito Koriyama

March 30, 2019
Tweet

Transcript

  1. 8.

    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. 38.

    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. 41.

    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. 42.
  5. 43.
  6. 56.
  7. 59.

    • text/html (hypermedia) • application/json • application/hal+json (hypermedia)
 
 •

    application/problem+json • vnd.amundsen.maze+xml (OFSJD %PNBJOTQFDJpD
  8. 64.

    $ 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
  9. 66.

    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
  10. 67.

    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
 }
 }
  11. 68.

    /BNJOH There are only two hard things in Computer Science:

    cache invalidation and naming things.
 -- Phil Karlton
  12. 70.
  13. 85.

    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