mirror of
https://github.com/LemmyNet/activitypub-federation-rust.git
synced 2024-11-14 12:41:16 +00:00
1.2 KiB
1.2 KiB
Federating posts
We repeat the same steps taken above for users in order to federate our posts.
$ curl -H 'Accept: application/activity+json' https://mastodon.social/@LemmyDev/109790106847504642 | jq
{
"id": "https://mastodon.social/users/LemmyDev/statuses/109790106847504642",
"type": "Note",
"content": "<p><a href=\"https://mastodon.social/tags/lemmy\" ...",
"attributedTo": "https://mastodon.social/users/LemmyDev",
"to": [
"https://www.w3.org/ns/activitystreams#Public"
],
"cc": [
"https://mastodon.social/users/LemmyDev/followers"
],
}
The most important fields are:
id
: Unique identifier for this object. At the same time it is the URL where we can fetch the object fromtype
: The type of this objectcontent
: Post text in HTML formatattributedTo
: ID of the user who created this postto
,cc
: Who the object is for. The special "public" URL indicates that everyone can view it. It also gets delivered to followers of the LemmyDev account.
Just like for Person
before, we need to implement a protocol type and a database type, then implement trait Object
. See the example for details.