Skip to content

Commit 6cf9ba6

Browse files
committed
more info
1 parent 7e4bca1 commit 6cf9ba6

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ The goal is to create a collction that can be used by someone in a clean room en
2222
- [Move Post](move-post.md) - User Migration
2323
- [Delete Post](delete-post.md) - Toot/Tweet/Post Deletion
2424
- [Follow Post](follow-post.md) - Follow Account
25-
26-
27-
Webfinger is described quite well at the following https://webfinger.net/ and should be considered essential reading as it is used across the fediverse.
28-
25+
- [Webfinger](webfinger.md) - Webfinger
26+
- [User](user.md) - Getting user details
2927

3028
PR's are encouraged!
3129

user.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# User
2+
3+
Fetching a users details usually follows a webfinger against the user to validate they exist.
4+
5+
Given a valid webfinger such as the following
6+
7+
https://mastinator.com/.well-known/webfinger?resource=acct:[email protected]
8+
9+
We can then query their self location to determine their inbox,
10+
11+
```json
12+
{
13+
"subject": "acct:[email protected]",
14+
"links": [
15+
{
16+
"rel": "self",
17+
"type": "application/activity+json",
18+
"href": "https://mastinator.com/u/someaccount"
19+
}
20+
]
21+
}
22+
```
23+
24+
The important part in the above is the `links.rel` where `self` indicates that the `href` for this object contains the location of this users details.
25+
26+
We can then issue a get request to this endpoint to get the details for the user.
27+
28+
```json
29+
curl --location --request GET 'https://mastinator.com/u/someaccount' \
30+
--header 'Accept: application/ld+json; profile="https://www.w3.org/ns/activitystreams"
31+
```
32+
33+
For mastodon the accept headers of `application/activity+json`, `application/ld+json; profile="https://www.w3.org/ns/activitystreams` or `application/json` will work for the above call, but many instance types will reject the first two. It is safer to use one of the first two which are strictly speaking more correct anyway.
34+
35+
Note that fetching the url without this header will usually result in a redirect to the HTML version of the users inbox, or return HTML directly.

webfinger.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Webfinger
2+
3+
Webfinger is described quite well at the following https://webfinger.net/ and should be considered essential reading as it is used across the fediverse.
4+

0 commit comments

Comments
 (0)