Difference between revisions of "ActivityPub Code"

From Organic Design wiki
(Add Client/Server service discovery notes.)
 
m (User Discovery)
Line 15: Line 15:
 
<source>
 
<source>
 
curl https://mastodon.online/users/testing_bridge \
 
curl https://mastodon.online/users/testing_bridge \
 +
-X GET \
 
-H "Accept: application/activity+json"
 
-H "Accept: application/activity+json"
 
</source>
 
</source>
  
 
That command should return an object describing the relevant endpoints for that user.
 
That command should return an object describing the relevant endpoints for that user.

Revision as of 20:21, 6 October 2021

https://www.w3.org/TR/activitypub

Client/Server

The specification doesn't seem to provide endpoints for interacting with an AP server, that is why I believe that most servers use WebFinger. The only issue is that I can't find that in the specification either.

User Discovery

To request the user's endpoint from the server run the following command.

curl <URL>/.well-known/webfinger?resource=<ACCOUNT NAME>@<URL> \
	-X GET \
	-H "Accept: application/json"

This should return an object describing the user on the server, you should look for inside the links property for an object that has the property "type": "application/activity+json", the next command should be made to the href property of that object.

curl https://mastodon.online/users/testing_bridge \
	-X GET \
	-H "Accept: application/activity+json"

That command should return an object describing the relevant endpoints for that user.