I’m implementing the Follow/Accept/Reject activity types in my server-to-server application. I’m trying to understand what is expected (by spec and by convention) for the "id"s of these activities.
When I receive a “Follow” activity from mastodon, it has an ID like “http://localhost:3000/562d0ad7-79ac-4c45-98f6-ceff5fbe583e”. However, this ID is not dereferenceable.
But the ActivityPub spec of course reads:
All Objects in [ActivityStreams] should have unique global identifiers. ActivityPub extends this requirement; all objects distributed by the ActivityPub protocol MUST have unique global identifiers, unless they are intentionally transient (short lived activities that are not intended to be able to be looked up, such as some kinds of chat messages or game notifications). These identifiers must fall into one of the following groups:
- Publicly dereferencable URIs, such as HTTPS URIs, with their authority belonging to that of their originating server. (Publicly facing content SHOULD use HTTPS URIs).
- An ID explicitly specified as the JSON
null
object, which implies an anonymous object (a part of its parent context)
So, a Follow is probably an “intentionally transient” activity, which means it doesn’t need an identifier? Certainly “2” can’t apply, since there is no parent context.
In any case, ignoring Mastodon for a moment, if we were to accept the language of the spec, would
"@context":"https://www.w3.org/ns/activitystreams",
"type":"Follow",
"actor":"http://localhost:3000/users/technical",
"object":"https://7902-75-164-4-199.ngrok-free.app/@helloworld"
}
be a valid Follow? If so, the response “Accept”/“Reject” would then have to inline the object:
{
"@context":"https://www.w3.org/ns/activitystreams",
"type":"Accept",
"actor":"https://7902-75-164-4-199.ngrok-free.app/@helloworld",
"object" : {
"@context":"https://www.w3.org/ns/activitystreams",
"id": null,
"type":"Follow",
"actor":"http://localhost:3000/users/technical",
"object":"https://7902-75-164-4-199.ngrok-free.app/@helloworld"
}
}
Where the ID is now set to null since there is now a parent context? Or without an ID again?
Alternatively, should Follow IDs just be non-transient and dereferencable? Accept too?