ユーザの取得
ユーザの取得
$ curl "akkoma.eneihack.net/.well-known/host-meta"
xpath式(名前空間ガン無視)における、/XRD/Link/@templateを取得する
code:xml
ならば
https://akkoma.eniehack.net/.well-known/webfinger?resource={uri}を取得し、{uri}にアカウント名を入れる(e.g. @eniehack@akkoma.eniehack.net→https://akkoma.eniehack.net/.well-known/webfinger?resource=@eniehack@akkoma.eniehack.net)
すると(Accept: application/jrd+jsonが要るかも?)、こんな感じのjsonが帰ってくる:
code:json
{"aliases":["https://akkoma.eniehack.net/users/eniehack"],"links":[{"href":"https://akkoma.eniehack.net/users/eniehack","rel":"http://webfinger.net/rel/profile-page","type":"text/html"},{"href":"https://akkoma.eniehack.net/users/eniehack","rel":"self","type":"application/activity+json"},{"href":"https://akkoma.eniehack.net/users/eniehack","rel":"self","type":"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""},{"rel":"http://ostatus.org/schema/1.0/subscribe","template":"https://akkoma.eniehack.net/ostatus_subscribe?acct={uri}"}],"subject":"acct:eniehack@akkoma.eniehack.net"} ので、/links/relがapplication/activity+jsonである要素の/links/hrefにあるURIにアクセスする
と、まあこんな感じになる:
code:json
{"@context":["https://www.w3.org/ns/activitystreams","https://akkoma.eniehack.net/schemas/litepub-0.1.jsonld",{"@language":"und"}],"alsoKnownAs":[],"attachment":[{"name":"Mastodon","type":"PropertyValue","value":"<a href=\"https://mstdn.sublimer.me/@eniehack\" rel=\"ugc\">https://mstdn.sublimer.me/@eniehack</a>"},{"name":"website","type":"PropertyValue","value":"<a href=\"https://eniehack.net/~eniehack\" rel=\"ugc\">https://eniehack.net/~eniehack</a>"},{"name":"amazonほしいものリスト","type":"PropertyValue","value":"<a href=\"https://www.amazon.co.jp/hz/wishlist/ls/30NC09U79HF2Z\" rel=\"ugc\">https://www.amazon.co.jp/hz/wishlist/ls/30NC09U79HF2Z</a>"}],"capabilities":{},"discoverable":false,"endpoints":{"oauthAuthorizationEndpoint":"https://akkoma.eniehack.net/oauth/authorize","oauthRegistrationEndpoint":"https://akkoma.eniehack.net/api/v1/apps","oauthTokenEndpoint":"https://akkoma.eniehack.net/oauth/token","sharedInbox":"https://akkoma.eniehack.net/inbox","uploadMedia":"https://akkoma.eniehack.net/api/ap/upload_media"},"featured":"https://akkoma.eniehack.net/users/eniehack/collections/featured","followers":"https://akkoma.eniehack.net/users/eniehack/followers","following":"https://akkoma.eniehack.net/users/eniehack/following","icon":{"type":"Image","url":"https://akkoma.eniehack.net/media/94cdd39c-de16-4981-8a1f-01161ba8a124/avi.png"},"id":"https://akkoma.eniehack.net/users/eniehack","inbox":"https://akkoma.eniehack.net/users/eniehack/inbox","manuallyApprovesFollowers":false,"name":"Nakaya","outbox":"https://akkoma.eniehack.net/users/eniehack/outbox","preferredUsername":"eniehack","publicKey":{"id":"https://akkoma.eniehack.net/users/eniehack#main-key", ...
inboxが今回重要で、ここに投稿を届けることになる