Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
速習XRPC / Learning XRPC
Search
鎌倉
April 28, 2023
Technology
0
450
速習XRPC / Learning XRPC
Bluesky/ATProtocol勉強会 #1の発表資料です。
Bluesky (ATP) のAPIを叩いてみたい人向けに、基本的な概念や触り方を解説しています。
鎌倉
April 28, 2023
Tweet
Share
More Decks by 鎌倉
See All by 鎌倉
Svelte & Nostr
akiomik
0
320
Nostrのカスタムフィードの現状 / About Nostr custom feed
akiomik
0
300
日本人が開発した アプリ紹介 / Introduction of apps developed by Japanese
akiomik
0
570
Bluesky と Android / Bluesky and Android
akiomik
0
910
Nostr版togetterのNosliとNIP-33 / About Nosli and NIP-33
akiomik
0
460
話題の投稿がみれるサービス Nostrendsをつくったよ🤙 / About Nostrends
akiomik
0
650
Other Decks in Technology
See All in Technology
IDOLY PRIDEのバックエンドリーダーになって2年半取り組んできたこと / idoly-pride-knowledge
cyberagentdevelopers
PRO
2
110
Amazon_CloudWatch_ログ異常検出_導入ガイド
tsujiba
4
1.7k
AWS re:Inventを徹底的に楽しむためのTips / Tips for thoroughly enjoying AWS re:Invent
yuj1osm
1
660
Forget efficiency – Become more productive without the stress
ufried
0
190
AI機能の開発運用のリアルと今後のリアル
akiroom
0
130
【若手エンジニア応援LT会】AWS Security Hubの活用に苦労した話
kazushi_ohata
0
250
いまさらのStorybook
ikumatadokoro
0
160
ZOZOTOWNでの推薦システム活用事例の紹介
f6wbl6
0
220
Exadata Database Service on Cloud@Customer セキュリティ、ネットワーク、および管理について
oracle4engineer
PRO
0
1.1k
プロポーザルのつくり方 〜個人技編〜 / How to come up with proposals
ohbarye
4
270
一休.comレストランにおけるRustの活用
kymmt90
3
640
ガバメントクラウド先行事業中間報告を読み解く
sugiim
1
1.8k
Featured
See All Featured
Building an army of robots
kneath
302
42k
Git: the NoSQL Database
bkeepers
PRO
426
64k
The Art of Programming - Codeland 2020
erikaheidi
51
13k
Gamification - CAS2011
davidbonilla
80
5k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Building Your Own Lightsaber
phodgson
102
6.1k
A better future with KSS
kneath
238
17k
Rails Girls Zürich Keynote
gr2m
93
13k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
The Power of CSS Pseudo Elements
geoffreycrofte
72
5.3k
KATA
mclloyd
29
13k
Transcript
श931$ #MVFTLZ"51SPUPDPMษڧձ ח !PNJCTLZTPDJBM
ࣗݾհ w 8FCΤϯδχΞ w ੨Ӣͱ͍͏#MVFTLZ༻"OESPJEΫϥΠΞϯτΛ࡞ͬͯ·͢ w IUUQTHJUIVCDPNBLJPNJLTFJVO
લఏࣝͱΰʔϧ w લఏࣝ w Ұൠతͳ8FC"1*͕৮ΕΔ w ˞࣮ऀࢹͷ͕த৺Ͱ͢ w ΰʔϧ w
-FYJDPOͷجຊతͳา͖ํ͕Θ͔Δ w ཁΛ͔͍ͭ·ΜͰۦ͚ؾຯʹਐΈ·͢
ΞδΣϯμ w ओཁͳͭͷ༻ޠ 931$ɺ-FYJDPOɺ/4*% w -FYJDPOೖ ୳͠ํͱओཁͳܕ w
ϦΫΤετͱೝূ w SFDPSEͱϦϙδτϦͷૢ࡞ w ͦͷଞ
ओཁͳͭͷ༻ޠ
931$ w $SPTTTZTUFN3FNPUF1SPDFEVSF$BMMT w 31$ ԕִखଓ͖ݺͼग़͠ ͷن֨ͷҰछ w H31$ 40"1
w "51SPUPDPMͷಠ༷ࣗ w )551 4 ͷ্Ͱಈ࡞ w 1%4ͱͷσʔλͷΓऔΓʹར༻
-FYJDPO w ϨΩγίϯ w ӳ<໊>༻ޠूɺޠኮɺࣙॻ w 931$ͷϝιουσʔλܕͷఆ ٛ w ·ͨͦΕΒͷϑΥʔϚοτ
+40/4DIFNB෩
/4*% w /BNF4QBDFE*% w -FYJDPOͷϦιʔεΛҰҙʹࣝผ͢ ΔͨΊͷ*% w 3FWFSTF%/4ܗࣜͰදه w +BWBͰΑ͘ݟΔΞϨ
w ΤϯυϙΠϯτ·ͨܕͱͯ͠༻
"51SPUPDPM 931$ Ͱͷ"1*ݺͼग़͠ -FYJDPOʹΑͬͯݺͼग़͕͠ఆΊΒΕͨ /4*%ܗࣜͷΤϯυϙΠϯτΛίʔϧ
-FYJDPOࣄ࢝Ί
-FYJDPOͷ୳͠ํ w ެࣜυΩϡϝϯτʹҰཡ͋Γ·͢ w IUUQTBUQSPUPDPNEPDT w ͨͩ͠ใ͕ݹ͔ͬͨΓෆ͍ͯ͠ Δ߹ w ࠷৽ͷ༷ʹ͍ͭͯHJUIVCͷϦϙδτ
ϦͷMFYJDPOTΛࢀর͢Δͷ͕࣮֬ w IUUQTHJUIVCDPNCMVFTLZTPDJBM BUQSPUPUSFFNBJOMFYJDPOT
-FYJDPOͷܕ w PCKFDU w QSPDFEVSF w RVFSZ w ϓϦϛςΟϒܕ JOUFHFSTUSJOHͳͲ
w ಛघͳܕ SFDPSE SFG VOJPO CMPC UPLFO TVCTDSJQUJPOͳͲ w ࠓճSFDPSEͷΈѻ͍·͢
PCKFDU { "id": "app.bsky.actor.defs", "defs": { "profileViewBasic": { "type": "object",
"required": ["did", "handle"], "properties": { "did": { "type": "string" }, "handle": { "type": "string" }, "avatar": { "type": "string" }, "viewer": { "type": "ref" }, "labels": { "type": "array" } } } } } w Ұൠతͳσʔλܕ w SFRVJSFEOPUOVMM w ˠͷ/4*% BQQCTLZBDUPSEFGTQSP fi MF7JFX#BTJD ˞ൈਮ
QSPDFEVSF { "id": "com.atproto.server.createSession", "defs": { "main": { "type": "procedure",
"input": { "schema": { "properties": { "identifier": { "type": "string" }, "password": { "type": "string" } } } }, "output": { "schema": { "properties": { "accessJwt": { "type": "string" }, "did": { "type": "string" }, } } } } } } w ߋ৽ܥϝιου w JOQVUPVUQVUΛ࣋ͭ w ӈͷ/4*% DPNBUQSPUPTFSWFSDSFB UF4FTTJPO NBJOলུ ˞ൈਮ
RVFSZ { "id": "app.bsky.feed.getTimeline", "defs": { "main": { "type": "query",
"parameters": { "type": "params", "properties": { "cursor": { "type": "string" } } }, "output": { "schema": { "properties": { "cursor": { "type": "string" }, "feed": { "type": "array" } } } } } } } w ࢀরܥϝιου w QBSBNFUFSTPVUQVUΛ࣋ͭ w ˠͷ/4*% BQQCTLZGFFEHFU5JNFMJO F ˞ൈਮ
ϦΫΤετͱೝূ
ϦΫΤετ w #MVFTLZͷ߹IUUQTCTLZTPDJBMYSQDOJTEʹରͯ͠ߦ͏ w αʔυύʔςΟ1%4ͷ߹ACTLZTPDJBMAͷ෦͕มΘΔ w ྫ w QSPDFEVSF1045IUUQTCTLZTPDJBMYSQD DPNBUQSPUPTFSWFSDSFBUF4FTTJPO
w RVFSZ(&5IUUQTCTLZTPDJBMYSQDBQQCTLZGFFEHFU5JNFMJOF
ϩάΠϯͷ-FYJDPO { "id": "com.atproto.server.createSession", "defs": { "main": { "type": "procedure",
"input": { "encoding": "application/json", "schema": { "required": [ "identifier", "password" ], "properties": { "identifier": { "type": "string" }, "password": { "type": "string" } } } } } } } ˞ൈਮ ϦΫΤετ1045 ϦΫΤετ#PEZ+40/ JEFOUJ fi FSͱQBTTXPSEඞਢ IBOEMFPSFNBJM ΤϯυϙΠϯτ YSQDDPNBUQSPUPTFSWFSDSFBUF4FTTJPO
ϩάΠϯͷϦΫΤετ curl -X POST \ -H 'Content-Type: application/json' \ -d
'{"identifier": "tester.bsky.social", "password": "foo"}' \ 'https://bsky.social/xrpc/com.atproto.server.createSession' # response { "did":"did:plc:ji4f2ypncqko5cm62pmyxh67", ... "accessJwt":"...", "refreshJwt":"..." } ೝূ͕ඞཁͳΤϯυϙΠϯτ ฦ͖ͬͯͨ+85ΛϦΫΤετʹؚΊΔ
RVFSZͷ-FYJDPO ϢʔβϑΟʔυͷऔಘ { "id": "app.bsky.feed.getAuthorFeed", "defs": { "main": { "type":
"query", "parameters": { "type": "params", "required": ["actor"], "properties": { "cursor": { "type": "string" } } } } } } ˞ൈਮ ϦΫΤετ(&5 ΫΤϦύϥϝʔλ ΤϯυϙΠϯτ YSQDBQQCTLZGFFEHFU"VUIPS'FFE BDUPS ͲͷϢʔβ͔ ඞਢ
RVFSZͷϦΫΤετ ϢʔβϑΟʔυͷऔಘ curl -X GET -H 'Authorization: Bearer ${createSessionで取得したaccessJwt}' 'https://bsky.social/xrpc/app.bsky.feed.getAuthorFeed?actor=foo'
ϦϙδτϦͱSFDPSE
ϦϙδτϦ %BUB3FQPTJUPSZ w 5-%3 w ϦϙδτϦॺ໊σʔλͷίϨΫγϣϯ w HJUͷϦϙδτϦΈ͍ͨͳͷ ͨͩ͠%#ͷϨίʔυ༻
w Ϣʔβ֤ʑͷެ։ΞΫςΟϏςΟΛࣗͷϦϙδτϦʹه w #MVFTLZ BQQCTLZ ͷ߹ɺߘɾϑΥϩʔɾ͍͍ͶͳͲ͕֨ೲ͞ ΕΔ
SFDPSE { "id": "app.bsky.feed.post", "defs": { "main": { "type": "record",
"key": "tid", "record": { "type": "object", "required": ["text", "createdAt"], "properties": { "text": { "type": "string" }, "createdAt": { "type": "string", "format": "datetime" } } } } } } w ϦϙδτϦ༻ͷσʔλܕ w ˠ#MVFTLZͷߘ QPTU ͷܕ ˞ൈਮ
ϦϙδτϦૢ࡞ { "id": "com.atproto.repo.createRecord", "defs": { "main": { "type": "procedure",
"input": { "encoding": "application/json", "schema": { "type": "object", "properties": { "repo": { "type": "string" }, "collection": { "type": "string" }, "record": { "type": "unknown" } } } } } } } w ϦϙδτϦͷϨίʔυ ՃͷQSPDFEVSF w ߘϑΥϩʔͳͲର ͱͳΔSFDPSEΛͯ͠ ߦ͏ ˞ൈਮ
ߘ࡞ͷϦΫΤετ curl -X POST \ -H 'Authorization: Bearer ${accessJwt}' \
-H 'Content-Type: application/json' \ -d '{ "repo": "tester.bsky.social", "collection": "app.bsky.feed.post", "record": { "text": "Hello, world!", "createdAt": "2023-04-28T22:00:00+09:00" } }' \ 'https://bsky.social/xrpc/com.atproto.repo.createRecord'
ͦͷଞࡉ͔͍৭ʑ w SLFZBUBMJDFIPTUDPNJPFYBNQMFTPOHZ*D[DDQBͷ Z*D[DDQB w CMPCͷܕ͜ͷลΛࢀর w େഁյҎલͷσʔλSFGͱTJ[F͕ͳ͍ͷͰҙ w !BUQSPUPBQJͩͱࣗಈͰSFGͱTJ[FΛิ͢ΔΑ͏ʹͳ͍ͬͯΔ
w ΤϥʔϋϯυϦϯά͜͜Λࢀর
ิͱ͔ w ۦ͚Ͱ͢Έ·ͤΜʂ w ʮࠓͷൃදͳΜΘ͔ΒΜ͔ͬͨʯͱ͍͏ํNBUUO͞Μͷʰ։ൃ ࢹ͔ΒݟΔɺ৽͍͠ࢄܕ4/4ʮ#MVFTLZʯͱ"51SPUPDPMͷՄೳ ੑʱͱ͍͏هࣄνΣοΫͯ͠Έ͍ͯͩ͘͞ w IUUQTHJIZPKQBSUJDMFCMVFTLZBUQSPUPDPM
Ҏ্🫡