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

Devsumi2016 OuchHackLT RESTful Toilet

Keiichiro
February 20, 2016

Devsumi2016 OuchHackLT RESTful Toilet

トイレにRESTfulなAPIを実装してみた
Developers Summit 2016 19-E-7 おうちハックLT大会で発表したスライドです。

Keiichiro

February 20, 2016
Tweet

More Decks by Keiichiro

Other Decks in Technology

Transcript

  1. τΠϨʹ3&45GVMͳ"1*Λ
    ࣮૷ͯ͠Έͨ
    ٢ଜܓҰ࿠
    ͚ʔ͍ͪ!42
    %FWFMPQFST4VNNJU%BZʲ&ʳ 'FCSVBSZ

    View full-size slide

  2. *OUFSOFUPG5IJOHT
    ϞϊͷΠϯλʔωοτ

    View full-size slide

  3. *OUFSOFUPG5PJMFU
    τΠϨͷΠϯλʔωοτ

    View full-size slide

  4. ḪΔ͜ͱ೥લ
    *OUFSOFUPG5PJMFUྺݩ೥݄೔

    View full-size slide

  5. r๭NSVCZͱ͔7JNͷਓ
    lศث͔ΒπΟʔτ͕ྲྀΕͩ͢·Ͱ͋ͱগ͠z
    r๭23ίʔυΛম͘ਓ
    lτΠϨྲྀ͢ϦϞίϯͷ৴߸Λड৴͢Ε͹

    ͙࣮͢ݱग़དྷͦ͏ɻେখͷ۠ผ΋ʜɻz
    ೥݄೔ͷ5XJUUFS
    Ұ෦লུ

    View full-size slide

  6. τΠϨπΠʔτCPU

    View full-size slide

  7. τΠϨπΠʔτCPUվ

    View full-size slide

  8. ͋Ε͔Β೥ʜ
    τΠϨˠωοτ͚ͩͰͳ͘
    *OUFSOFUPG5PJMFUྺ೥݄೔
    ωοτˠτΠϨͷ࣌୅͕དྷΔ

    View full-size slide

  9. τΠϨʹ3&45GVMͳ"1*Λ
    ࣮૷ͯ͠ΈΑ͏

    View full-size slide

  10. ϋʔυ΢ΣΞબఆ
    IUUQFTQSFTTJGDPNFOQSPEVDUTXSPPN
    &418300.
    &41&9DIJQTFU
    w 5$1*1ϓϩτίϧελοΫ౥ࡌCJU.$6
    w 8J'J45" "1 45""1
    w CJU"%$XJUI)41* 4%*0 6"35 18. *$ BOE*4
    㾎؆୯
    㾎͍҆
    㾎ແઢ-"/

    View full-size slide

  11. ϋʔυ΢ΣΞߏ੒
    w &418300. XJUIΦϦδφϧج൘

    w ੺֎ઢ-&%
    έʔε
    %ϓϦϯλͰ੡࡞ ج൘
    εΠοναΠΤϯε1$#

    View full-size slide

  12. ϦϞίϯ͔ΒίʔυΛऔಘ
    "SEVJOP6/0ʹ੺֎ઢϦϞίϯड৴ϞδϡʔϧΛ઀ଓ
    1-*3.9%
    "SEVJOP*3SFNPUF
    IUUQTHJUIVCDPN[U"SEVJOP*3SFNPUF
    FYBNQMF*3SFDW%VNQΛॻ͖ࠐΜͰ
    γϦΞϧϞχλͰऔಘ

    View full-size slide

  13. ϦϞίϯ͔ΒίʔυΛऔಘ
    τΠϨͷϦϞίϯ͕
    ૹ৴͍ͯ͠Δ৴߸Λ(&5
    ྲྀ͢ খ

    ྲྀ͢ େ

    ఀࢭ ఀࢭ
    ΍ΘΒ͔ ΍ΘΒ͔
    ૹ৴։࢝Ϧʔμ෦
    ໿NT NT

    σʔλ෦
    NT NT͕ଓ͘
    ྲྀ͢Ҏ֎ͷίϚϯυ͸
    ճʹ෼͚ͯૹ৴͞Ε͍ͯΔ

    View full-size slide

  14. ϓϩάϥϜΛॻ͘ॻ͖ࠐΉ
    ແઢ-"/઀ଓ͢Δ
    αʔόىಈ
    ϦΫΤετΛड͚Δ
    ੺֎ઢૹ৴
    &41DPSFGPS"SEVJOP
    IUUQTHJUIVCDPNFTQ"SEVJOP

    &418300.Λ୯ମͰ
    "SEVJOPͷΑ͏ʹ࢖͑Δ

    *3SFNPUF&41
    IUUQTHJUIVCDPNNBSLT[BCP*3SFNPUF&41

    L)[Ͱมௐͯ͠੺֎ઢ-&%Λ
    ఺໓ͤ͞ΔϥΠϒϥϦ
    τʔλϧ
    ߦ͘Β͍

    View full-size slide

  15. IUUQUPJMFUMPDBM
    )5.- CPPUTUSBQ
    +BWB4DSJQU
    ϘλϯΛԡ͢ͱ9.-)UUQ3FRVFTUͰ

    ֤ίϚϯυΛୟ͘
    N%/4ରԠϒϥ΢βͰΞΫηεՄೳ
    "OESPJE͸ʜ

    View full-size slide

  16. UPJMFUMPDBMXBTIMFU
    ͓͠ΓΛચড়͍ͨ͠ͱ͖
    curl -X POST -d 'c=rear' http://toilet.local/washlet
    ચড়ΛࢭΊ͍ͨͱ͖
    curl -X POST -d 'c=stop' http://toilet.local/washlet

    exam
    ple
    ®
    ΢ΥγϡϨοτ, Washlet͸TOTOͷొ࿥঎ඪͰ͢

    View full-size slide

  17. UPJMFUMPDBMXBTIMFU
    ʮେʯΛྲྀ͢ͱ͖
    curl -X DELETE -d 'c=big' http://toilet.local/washlet

    ®
    ΢ΥγϡϨοτ, Washlet͸TOTOͷొ࿥঎ඪͰ͢
    exam
    ple

    View full-size slide

  18. ΋͏গ͠εϚʔτʹ
    ͠Α͏͡Όͳ͍͔

    View full-size slide

  19. "OESPJEΞϓϦ࡞Γ·ͨ͠ɻ
    "OESPJEd

    ✔௨஌ྖҬʹৗற
    ଞͷΞϓϦىಈத΋γʔϜϨεʹ
    ͓͠Γͷચড়͕Մೳ

    View full-size slide

  20. Blog
    શ෦·ͱΊͯެ։த
    τΠϨʹ3&45GVMͳ"1*Λ࣮૷ͯ͠Έͨ
    IUUQFMFDMPHRVJUTRDPN
    SFTUGVMUPJMFUIUNM
    ੺֎ઢϦϞίϯͰૢ࡞Ͱ͖Δ
    ػث ՈిʹԠ༻Մೳ

    View full-size slide

  21. G
    itH
    ub
    શ෦·ͱΊͯެ։த
    &418300. &41
    ޲͚ίʔυ
    IUUQTHJUIVCDPN423&45GVM5PJMFU
    "OESPJEΞϓϦͷίʔυ
    IUUQTHJUIVCDPN423&45GVM5PJMFU"QQ
    ੺֎ઢϦϞίϯͰૢ࡞Ͱ͖Δ
    ػث ՈిʹԠ༻Մೳ

    View full-size slide

  22. Ϟϊ͕ωοτϫʔΫʹܨ͕Γ
    3&45GVM"1*Λ࣋ͭ
    τΠϨ

    View full-size slide

  23. τΠϨºʁʁʁͷՄೳੑ
    㾎"1*Λ༩͑Δ͚ͩͰग़དྷΔ͜ͱ͕Ұؾʹ޿͕Δ
    Ի੠ೝࣝର࿩Ͱ͖ΔτΠϨʁ
    ʮIFZ4JSJ ͓͠Γચͬͯʂʯ

    ਓ޻஌ೳߦಈ༧ଌ͢ΔτΠϨʁʁ
    ͓৲Λճચ͏ਓ͕དྷͨͧʂ
    㾎༷ʑͳطଘιϑτ΢ΣΞٕज़ཁૉͱ૊Έ߹Θͤͯʜ

    View full-size slide

  24. MPDBM
    -FU`T&OKPZ͓͏ͪϋοΫʂ
    ྲྀߦΒͳ͍͔ͳ͊ʜ

    View full-size slide