Save 37% off PRO during our Black Friday Sale! »

Web API 完全に理解した 〜黎明編〜 / Web API Completely Understood -Dawn-

E629af0f4930348f61b8f5cc1af49870?s=47 星影
January 30, 2020

Web API 完全に理解した 〜黎明編〜 / Web API Completely Understood -Dawn-

「完全に理解した人達の「Web技術」Talk #1」の発表スライドです。
https://easy2.connpass.com/event/161840/

E629af0f4930348f61b8f5cc1af49870?s=128

星影

January 30, 2020
Tweet

Transcript

  1. Web API ׬શʹཧղͨ͠ ʙᴈ໌ฤʙ

  2. @unsoluble_sugar
 TOPGATE, Inc. Leader/Engineer

  3. Web API ׬શʹཧղͯ͠·͔͢ʁ

  4. ฉ͍ͨ͜ͱ͋Δ
 ׬શʹཧղͨ͠ Կ΋Θ͔Βͳ͍ νϣοτσΩϧ

  5. ฉ͍ͨ͜ͱ͋Δ
 ׬શʹཧղͨ͠ Կ΋Θ͔Βͳ͍ νϣοτσΩϧ

  6. ֓ཁ • ର৅͸ ฉ͍ͨ͜ͱ͋Δਓ • ׬શʹཧղͨ͠ঢ়ଶʹͳΔͨΊͷೖ໳ฤ • ࡉ͔͍આ໌͸ল͖·͢ • ෆ଍෦෼͸ॻ੶΍Webͷ৘ใͰิ׬ͯ͠Ͷ

  7. Web APIͱ͸ʁ

  8. Web APIͱ͸ • APIͱ͸ʮApplication Programming Interfaceʯͷུ • ֎෦͔ΒػೳΛར༻͢ΔͨΊͷ࢓૊Έ • HTTPϓϩτίϧΛ༻͍ͯɺωοτϫʔΫӽ͠ʹػೳΛݺͼग़͢

    APIͷ͜ͱΛʮWeb APIʯͱݺͿ
  9. ͲΜͳαʔϏεͰ࢖ΘΕͯΔͷʁ

  10. Web API͕࢖ΘΕ͍ͯΔαʔϏε • GoogleɺAmazonɺTwitterɺFacebookɺetc… • ੈͷதʹ͸Web APIΛલఏͱͨ͠αʔϏε͕ᷓΕ͍ͯΔ
 χϡʔεɺఱؾɺ஍ਤɺSNSɺγϣοϐϯάɺήʔϜɺΤϯλϝͳͲͳͲ • αʔό௨৴Λߦ͏εϚϗΞϓϦͰ΋ར༻

    • ެ։/ඇެ։ͷWeb API͕ଘࡏ
  11. ۩ମతʹ͸ʁ

  12. Twitter APIͷ৔߹ • Twitter͸Web APIΛఏڙ͍ͯ͠Δ • ։ൃऀ͸Web APIΛར༻ͯ͠Twitterͷ༷ʑͳػೳ͕࢖͑Δ • ଟ͘ͷαʔυύʔςΟ੡ΫϥΠΞϯτ͕։ൃ͞Εൃల

    • ࠷ۙ͸࢖༻੍ݶ͕ݫ͍͠…
  13. APIϦϑΝϨϯε https://developer.twitter.com/en/docs/api-reference-index
 
 
 
 
 
 


  14. ࢓༷ৄࡉ͕ެ։͞Ε͍ͯΔ ։ൃऀ͸APIΛ࢖ͬͯಠࣗͷΞϓϦ΍WebαʔϏεΛ࡞Δ͜ͱ͕Ͱ͖Δ
 
 
 
 
 
 
 


  15. ࣮ࡍͷAPIͷಈ͖͸ʁ

  16. ϢʔβʔλΠϜϥΠϯऔಘ HTTPϝιου GET Ϩεϙϯεܗࣜ JSON υϝΠϯ https://api.twitter.com ΤϯυϙΠϯτ /1.1/statuses/user_timeline.json ύϥϝʔλ

    screen_name, count, include_rts, etc… ೝূ Bearer Token
  17. APIϦΫΤετΛ౤͛Δͱ… $ curl "https://api.twitter.com/1.1/statuses/user_timeline.json? screen_name=unsoluble_sugar&count=10" -H "Authorization: Bearer <ACCESS_TOKEN>" |

    jqɹ
  18. λΠϜϥΠϯͷ৘ใ͕JSONͰऔಘͰ͖Δ { "created_at": "Sun Jan 19 12:33:32 +0000 2020", "id":

    1218874129316638700, "id_str": "1218874129316638720", "text": "ϦΫΤετϔομʔͷAuthorizationͬͯɺ೔ຊޠͰදݱ͢Δͱʮೝূํࣜʯͱ͔Ͱྑ͍ͷ͔͠Β", }, "source": "<a href=\"https://about.twitter.com/products/tweetdeck\" rel=\"nofollow\">TweetDeck</a>", "user": { "id": 149069183, "id_str": "149069183", "name": "੕Ө", "screen_name": "unsoluble_sugar", "location": "ೋ࣍ݩ", "description": "Tech Hunter୅දɻશจݕࡧ/εϚϗήʔϜ/νϟοτbot/IoTͱ͔΍ͬͯΔࡶଟͳΤϯδχΞɻ࠷ۙ͸PM΋݉೚ɻFlutter/GCP/FirebaseษڧதɻΨδΣΦλͰΞχ ΦλͰήʔΦλɻྦྷܭ1000ສPVͷݸਓϒϩάӡӦɻ2ࣇͷύύɻຊ୨ɿhttps://t.co/kGyfPuFvIO", "url": "https://t.co/h7Iq47ug5Z", "entities": { "url": { "urls": [ { "url": "https://t.co/h7Iq47ug5Z", "expanded_url": "https://unsolublesugar.com", "display_url": "unsolublesugar.com", …
  19. ϨεϙϯεσʔλΛղੳͯ͠ը໘ʹ൓ө • πΠʔτ৘ใ
 textɿΫι຾͍
 created_atɿSun Jan 19 12:33:32 +0000 2020


    sourceɿTweetDeck • Ϣʔβʔ৘ใ
 user.profile_image_urlɿhttp://pbs.twimg.com/profile_images/1109649870594293766/AQHwKd6N_normal.jpg
 user.nameɿ੕Ө
 user.screen_nameɿunsoluble_sugar

  20. ༷ʑͳ৘ใ͕APIͰऔಘͰ͖Δ • ϗʔϜλΠϜϥΠϯͷऔಘ
 GET statuses/home_timeline • ݸผπΠʔτͷऔಘ
 GET statuses/show/:id •

    Ϧετͷऔಘ
 GET lists/list • ϑΥϩϫʔ৘ใҰཡͷऔಘ
 GET followers/list
  21. GETҎ֎͸σʔλͷੜ੒ɺߋ৽ɺ࡟আ • πΠʔτͷ౤ߘ
 POST statuses/update • ը૾ͷΞοϓϩʔυ
 POST media/upload •

    DMͷ࡟আ
 DELETE direct_messages/events/destroy • DMͷ΢ΣϧΧϜϝοηʔδมߋʢ͜Μͳػೳ͋ͬͨΜ͔…ʣ
 PUT direct_messages/welcome_messages/update
  22. Twitter͸Web APIͰग़དྷ͍ͯΔ

  23. Web API

  24. ׬શʹཧղͨ͠ʁ

  25. • HTTPϔομʔɺϘσΟʢϦΫΤετɾϨεϙϯεʣ • HTTPϝιου • ΤϯυϙΠϯτ • ΫΤϦετϦϯάʢURLύϥϝʔλʔʣ • URLΤϯίʔσΟϯά

    • ϑΟϧλɺιʔτɺݕࡧɺϖʔδωʔγϣϯ • ೝূɺೝՄʢBasic, OAuth2, OpenID Connectʣ • ηογϣϯ؅ཧ • σʔλܕ • ग़ྗܗࣜʢJSON, XML, HTMLʣ • ΤϥʔϋϯυϦϯά • εςʔλείʔυʢ200, 404, 502ʣ • APIαʔόɺWebαʔό • όʔδϣϯ؅ཧ • ઃܭʢRESTfulʣ • ηΩϡϦςΟ
  26. None
  27. ࢀߟॻ੶ • WebΛࢧ͑Δٕज़ ᴷ HTTPɺURIɺHTMLɺͦͯ͠REST
 ࢁຊཅฏɹஶʢWEB+DB PRESS plusʣ
 2010೥4݄ ൃߦ


    • Web API: The Good Parts
 ਫ໺ و໌ɹஶʢΦϥΠϦʔδϟύϯʣ
 2014೥11݄ ൃߦ
  28. Α͏ͦ͜
 Web API ͷੈք΁