Skip to content

Piero Bosio Social Web Site Personale Logo Fediverso

Social Forum federato con il resto del mondo. Non contano le istanze, contano le persone

ap, the ActivityPub API command-line client

Social Web Foundation
1 1 0
  • As part of my book “ActivityPub: Programming for the Social Web“, I created a coding example to show how to program for the ActivityPub API. ap is a command-line client, written in Python, for doing basic tasks with ActivityPub.

    For example, you can log into a server using this command:

    ap login yourname@yourserver.example

    Once you’re logged in, you can follow someone:

    ap follow other@different.example

    Or, you could post some content:

    ap create note --public "Hello, World"

    This isn’t enough to have a real social networking experience, but I think it’s pretty useful for testing an ActivityPub API server, or automating some repetitive tasks.

    I should note quickly here that not all ActivityPub servers support the ActivityPub API. It’s an under-utilized part of the ActivityPub standard. In particular, Mastodon, Threads, Flipboard, and other services don’t support the API. There’s a pretty good list of servers and clients that do support the API in this Codeberg issue.

    Suffice it to say, unless you’re actively working with one of those platforms, or you are writing your own, you’re not going to get much use out of ap. It will probably give you an error message like “No OAuth endpoints found” if it can’t use the service.

    Refreshing the project

    I’ve never packaged ap for distribution; it was always supposed to be example code. But given the recent interest in the ActivityPub API, including the work going on in the ActivityPub API task force, I decided to get it into shape for installation by developers working on other apps. My friend Matthias Pfefferle of Automattic asked me about it when we were at FOSDEM this year, and I was embarrassed to see how difficult it was for him to use.

    So, I’ve made two big upgrades to the package. The first was actually making it a package, and distributing it! I upgraded the package management framework to uv, which seems like a good bet for now, and pushing the application to PyPI, the Python Package Index. It’s visible at https://pypi.org/project/activitypub-cli/ now. (Note: different package name from the command name! The PyPI “ap” package name was taken a while ago.)

    You can now install the application in one shot with this command on a computer that has Python on it:

    pipx install activitypub-cli

    You can test that the application installed correctly in your path by running the version command:

    ap version

    That should show the same version as is currently on the pypi.org page for the project.

    The second change was implementing the current OAuth 2.0 profile best practices. I’ve upgraded the login flow so it tries a lot of different options for identifying itself to the server: CIMD, FEP d8c2, and Dynamic Client Registration. It tries to do them in preferential order; it uses permanent, global client identifiers before dynamic ones.

    Help me test

    I’m especially interested in testing this command-line client against other servers. If you’re developing an ActivityPub API server, please install the ap command and try it out against your (development!) server. Report a bug if it doesn’t work well, or send me a DM at @evanprodromou if it works OK. Given time, I think ap can be a useful first smoke test for ActivityPub API implementations.

  • hongminhee@hollo.socialundefined hongminhee@hollo.social shared this topic

Gli ultimi otto messaggi ricevuti dalla Federazione
  • As part of my book “ActivityPub: Programming for the Social Web“, I created a coding example to show how to program for the ActivityPub API. ap is a command-line client, written in Python, for doing basic tasks with ActivityPub.

    For example, you can log into a server using this command:

    ap login yourname@yourserver.example

    Once you’re logged in, you can follow someone:

    ap follow other@different.example

    Or, you could post some content:

    ap create note --public "Hello, World"

    This isn’t enough to have a real social networking experience, but I think it’s pretty useful for testing an ActivityPub API server, or automating some repetitive tasks.

    I should note quickly here that not all ActivityPub servers support the ActivityPub API. It’s an under-utilized part of the ActivityPub standard. In particular, Mastodon, Threads, Flipboard, and other services don’t support the API. There’s a pretty good list of servers and clients that do support the API in this Codeberg issue.

    Suffice it to say, unless you’re actively working with one of those platforms, or you are writing your own, you’re not going to get much use out of ap. It will probably give you an error message like “No OAuth endpoints found” if it can’t use the service.

    Refreshing the project

    I’ve never packaged ap for distribution; it was always supposed to be example code. But given the recent interest in the ActivityPub API, including the work going on in the ActivityPub API task force, I decided to get it into shape for installation by developers working on other apps. My friend Matthias Pfefferle of Automattic asked me about it when we were at FOSDEM this year, and I was embarrassed to see how difficult it was for him to use.

    So, I’ve made two big upgrades to the package. The first was actually making it a package, and distributing it! I upgraded the package management framework to uv, which seems like a good bet for now, and pushing the application to PyPI, the Python Package Index. It’s visible at https://pypi.org/project/activitypub-cli/ now. (Note: different package name from the command name! The PyPI “ap” package name was taken a while ago.)

    You can now install the application in one shot with this command on a computer that has Python on it:

    pipx install activitypub-cli

    You can test that the application installed correctly in your path by running the version command:

    ap version

    That should show the same version as is currently on the pypi.org page for the project.

    The second change was implementing the current OAuth 2.0 profile best practices. I’ve upgraded the login flow so it tries a lot of different options for identifying itself to the server: CIMD, FEP d8c2, and Dynamic Client Registration. It tries to do them in preferential order; it uses permanent, global client identifiers before dynamic ones.

    Help me test

    I’m especially interested in testing this command-line client against other servers. If you’re developing an ActivityPub API server, please install the ap command and try it out against your (development!) server. Report a bug if it doesn’t work well, or send me a DM at @evanprodromou if it works OK. Given time, I think ap can be a useful first smoke test for ActivityPub API implementations.

    read more

  • I’m going to be participating in the Growing the Open Social Web workshop at Fediforum on March 3, 2026. I’m excited to talk to other people who care about the Fediverse about ways to connect more people through ActivityPub.

    Fediforum invited attendees to publish position papers before the workshop. SWF has a number of hypotheses about growth of the social web; I’ll try to summarise some of them here.

    Growth can’t come at the expense of privacy. People currently on the Fediverse must have the tools they need to preserve their privacy as the network grows. This means privacy from other users, as well as privacy from new platform operators. Expanding the options for private interactions on the Fediverse, like end-to-end encrypted messages and private groups, is necessary for preserving privacy as the user base and platform list expands.Connecting platforms to the Fediverse is our most efficient way to grow. There are already billions of people on social platforms across the Internet. Getting these platforms to let users publish to the Fediverse, as well as having two-way interactions with remote users, lets people share in the benefits of the Fediverse with a platform and interface that they’re already used to. Even when brand new social platforms adopt ActivityPub, they bring their new features and users.Connecting communities helps us grow fast and stay cohesive. Bringing formal and informal communities onto the Fediverse is a great way to enable a lot of new users quickly. By formal communities, we mean organized groups like clubs, universities and schools, professional societies, enterprises, or local and regional governments. These groups can set up their own places on the Fediverse, like Mastodon servers, and provide user accounts for all their members. (One great way to connect formal communities is to Fediverse-enable the community platforms they already use.) These new Fediverse users have the kind of connections in place that retain active users, as well as the support they need to use the Fediverse. More informal communities, like people sharing the same profession, fans of a particular hobby, or users of a language or technology, can be great additions to the Fediverse, but these groups are less cohesive and less likely to bring their own infrastructure.People come to social networks for existing social ties. Bringing on new users one-by-one is the most difficult way to grow this network. The best way to engage new users on the network, and to keep them active and interested, is to make sure they can connect to people they already know and care about. That may be friends, family, colleagues and neighbours, or brands, creators, and publications they recognise. Our onboarding processes for Fediverse users need to encourage the social contacts so that people feel a reason to stick around for day 2, 7, and 30.

    We’re looking forward to engaging with the Fediforum community on these and other topics. We’ll see you on March 3!

    read more

  • @renata @evanprodromou @fabio I hope it is important!

    read more

  • @evanprodromou Aw man, it’s a Tuesday! Any chance there will be an online feed for us who can’t be in Montréal?

    I’m really sad, both me and @fabio would LOVE to see every one of you speaking in person but we’re in Toronto.

    I know this is going to be not only good, but important.

    read more

  • @viktor @evanprodromou please do!

    read more

  • @evanprodromou @evan nice. I need to see if I can make it.

    read more

  • A brief note: the Social Web Foundation, Qlub and FediHost are presenting a day-long Fediverse conference in Montreal, Canada on February 24, 2026. FediMTL features speakers from across the Fediverse, including Cory Doctorow, Christine Lemmer-Webber, Julian Lam, and yours truly, Evan Prodromou. The theme of digital autonomy for Canada has never been more important. Tickets are on sale now for both in person and streaming attendance. I look forward to seeing you there!

    read more

  • Next week is European Open Source Week in Brussels, culminating in FOSDEM 2026 on the weekend. There are several important ways to stay connected to the Fediverse while you’re visiting this week!

    Mastodon maintains a booth at FOSDEM throughout the weekend. It’s a great place to get Mastodon merch or take a selfie with the Mastodon team.The Social Web Dev Room is a day-long event on Jan 31 in room H.2215 with loads of talks about Fediverse software and Fediverse organizing.There will be a loose mingling of Fediverse people at the À La Mort Subite bar in Brussels on Friday Jan 30 after 8PM. Wear a Fediverse symbol on a nametag or some other creative way so people can find you. Find your own table and then start mingling. There’s no organized activities or special space; just a node in space-time where you’re more likely to run into Fediverse people than normal.

    As always, watch the and and hashtags for news and updates.

    If you’re not travelling to Brussels, watch for streaming video from room H.2215 . There are also Fediverse events happening throughout the world throughout the year; Fediforum keeps a great list of the most prominent.

    read more
Post suggeriti
  • 0 Votes
    2 Posts
    12 Views
    @potatomeow@fosstodon.org the blog itself could be a Group, and your account as the Person. That's one way you can set up a WordPress install.
  • ... und übrigens.

    Fediverso wordpress fediverse activitypub
    1
    0 Votes
    1 Posts
    9 Views
    ... und übrigens. #wordpress und #fediverse sind DAS Feature! Das funktioniert inzwischen super reibungslos und mich wundert, dass das noch nicht vollkommen explodiert ist. Was geht ab? #activitypub
  • 0 Votes
    1 Posts
    16 Views
    @pachli Is this a problem in the app or in the original post, which comes from a WordPress site.#pachli #activitypub
  • 0 Votes
    1 Posts
    15 Views
    This is an extension of the discussion from Topic removal from a category/community. In it, rimu@piefed.social shared the Lemmy federation primer which details that Delete(Object) is federated whenever a post is removed from a community. I needed a way to communicate when a topic/context (not the top-level post) is removed from a category/audience, but is not deleted. You might ask — how is removing a context different from deleting it? In this case, a removed context still exists and is still resolvable. A context can removed from an audience in NodeBB. Note that Lemmy and Piefed don't have a concept of an audience-less context, so if a context is removed from an audience, it would simply be deleted. No additional logic required. Anyhow — when a topic is moved into Uncategorized (which is a catch-all bucket for... you guessed it, uncategorized content), NodeBB will federate a Remove. It looks something like this: { id: '#activity/remove/', type: 'Remove', actor: '', to: [], cc: [, object: '', origin: '', } This is live on activitypub.space already. This goes hand-in-hand with topic moving, which would follow similar mechanisms, except it'd be a Move instead of a Remove. I will likely write an FEP with technical details for both Remove and Move, and will include existing behaviours (Delete(Object)) as well.