JSON:API入門 / Introduction to JSON:API

JSON:API入門 / Introduction to JSON:API

Transcript

  1. JSON:API ೖ໳ Drupal ͷ Web API JSON:API ͱ͸ʁ JSON:API ΤϯυϙΠϯτ

    CRUDΦϖϨʔγϣϯ ߴ౓ͳϦιʔεͷऔಘํ๏ σϞ Q&A AGENDA
  2. ຊ೔ͷεϐʔΧʔ ΞΫΠΞδϟύϯ
 ؛ढ़ฌ ιϦϡʔγϣϯΤϯδχΞ ΞΫΠΞδϟύϯ
 ؙࢁͻ͔Δ ςΫχΧϧτϥϯεϨʔλʔ ͰͿͪΌΜͶΔ

  3. Drupal͸API-FirstɺHeadless Architecture ʹ ྗΛೖΕ͍ͯΔʂ https://dri.es/state-of-drupal-presentation-july-2020

  4. Drupal ͷ Web API – RESTful Web Services – REST

    API – ίΞϞδϡʔϧ
 – JSON:API – REST API – ίΞϞδϡʔϧ
 – GraphQL – ΫΤϦݴޠ – ίϯτϦϏϡʔτϞδϡʔϧ
  5. Drupal ͷ Web API – RESTful Web Services – REST

    API – ίΞϞδϡʔϧ
 – JSON:API – REST API – ίΞϞδϡʔϧ
 – GraphQL – ΫΤϦݴޠ – ίϯτϦϏϡʔτϞδϡʔϧ
  6. JSON:API ͱ͸ - 2016೥ΑΓ։ൃ։࢝ - Drupal 8.7 ʙ ίΞϞδϡʔϧͱͯ͠ಋೖ -

    DrupalͷϢʔβʔͱύʔϛογϣϯΛ׆༻ - JSON API ͷ࢓༷ʹ४ڌ
  7. JSON:API ͱ͸ JSON API ͱ͸ - https://jsonapi.org - JSONͰAPIΛ࡞੒͢ΔͨΊͷΦʔϓϯελϯμʔυͳ࢓༷ -

    ڞ༗͞Εͨن໿ʹै͏͜ͱͰ
 RESTful APIΛਝ଎͔ͭҰ؏ͯ͠࡞੒ - 2016೥ΑΓ։ൃ։࢝ - Drupal 8.7 ʙ ίΞϞδϡʔϧͱͯ͠ಋೖ - DrupalͷϢʔβʔͱύʔϛογϣϯΛ׆༻ - JSON API ͷ࢓༷ʹ४ڌ
  8. JSON:APIͷΤϯυϙΠϯτ - /jsonapi/node/article
 શͯͷهࣄ(article)ϦιʔεΛऔಘ - /jsonapi/node/article/xxx
 UUID=xxx ͷهࣄΛऔಘ - /jsonapi/node/article/xxx/uid


    هࣄ(UUID=xxx)ͱඥ෇͘౤ߘऀ(Ϣʔβʔ)ϦιʔεΛऔಘ
  9. None
  10. JSON:API ͷ CRUD ΦϖϨʔγϣϯ GET POST PATCH DELETE ➔Ϧιʔεͷऔಘʢ୯Ұ or

    ෳ਺ʣ ➔৽͍͠ϦιʔεΛ࡞੒ ➔طଘͷϦιʔεͷߋ৽ ➔طଘͷϦιʔεͷ࡟আ PUT͸ະରԠ GETͷΈෳ਺ϦιʔεΛѻ͑Δ
  11. ߴ౓ͳϦιʔεऔಘํ๏ - ϑΟϧλϦϯά - ιʔτ - ϖʔδωʔγϣϯ

  12. ߴ౓ͳϦιʔεͷऔಘํ๏ɿϑΟϧλϦϯά GET /jsonapi/node/article?filter[label-a][condition][path]=title &filter[label-a][condition][operator]=CONTAINS &filter[label-a][condition][value]=react λΠτϧͰߜΓࠐΈ GET /jsonapi/node/article?filter[label-b][condition][path]=created &filter[label-b][condition][operator]=< &filter[label-b][condition][value]=1598713200

    ೔෇ͰߜΓࠐΈ
  13. ߴ౓ͳϦιʔεͷऔಘํ๏ɿιʔτ GET /jsonapi/node/article?sort[sort-title][path]=title λΠτϧͰιʔτʢະࢦఆ࣌͸ঢॱʣ GET /jsonapi/node/article?sort[sort-title][path]=title &sort[sort-title][direction]=DESC λΠτϧͰ߱ॱιʔτ

  14. ߴ౓ͳϦιʔεͷऔಘํ๏ɿϖʔδωʔγϣϯ GET /jsonapi/node/article?page[offset]=20 &page[limit]=10 Ґஔ20͔Β10ݸऔಘ

  15. σϞΞϓϦέʔγϣϯͷߏ੒ - όοΫΤϯυ - Drupal 8
 - ϑϩϯτΤϯυ - React

    DEMO https://github.com/DrupalizeMe/react-and-drupal-examples
  16. JSON:API ೖ໳ AGENDA Drupal ͷ Web API JSON:API ͱ͸ʁ JSON:API

    ΤϯυϙΠϯτ CRUDΦϖϨʔγϣϯ ߴ౓ͳϦιʔεͷऔಘํ๏ σϞ Q&A
  17. ࢀߟࢿྉ • JSON:API υΩϡϝϯτ ◦ https://www.drupal.org/docs/core-modules-and-themes/core-modules/ jsonapi-module • JSON API

    ◦ https://jsonapi.org • ࢖༻ͨ͠σϞΞϓϦͷιʔείʔυ ◦ https://github.com/DrupalizeMe/react-and-drupal-examples • JSON:APIͷσϞಈը (Dries Buytaert) ◦ https://youtu.be/zEsNlAeYRn8
  18. None