Logbook + Scratchpad

fediverse

I am evaluating whether to make use of another federated platform like BookWyrm (self-hosted) or not. The choice is between a separate account on a more specialized social network and a consolidated blog where to cover every topic.

The nice thing about BookWyrm is its book search function that uses public APIs to get information about a book. I am less interested in tracking my reading activity and more into having a place where to keep my reading notes and “organize” my books.

In the meantime, here is the BookWyrm instance I've created: https://books.nvitucci.social/

As of now, it's still empty.

#fediverse #choices

A couple days ago, I was looking at the WriteFreely logs to find out why a follower was not being counted in the Stats page. While investigating the WriteFreely API later on, I was somewhat surprised that such information was not being exposed.

It turns out that the next version of WriteFreely will have both an endpoint and a detailed page to view the subscribers (I've just looked at the related PR). In the meantime, I decided to take a look at the database.

The following SQL query shows the public ID and URL of the followers (assuming the database is the one WriteFreely uses):

SELECT actor_id, url FROM remoteusers;

I've also found another interesting table that contains the users' public keys:

SELECT id, public_key FROM remoteuserkeys;

This of course got my interested in some more technical details of the ActivityPub format. I want to experiment a little with my own profile, but at the moment it is still unavailable so I'll hold off until I restore it.

#TIL #tech #fediverse

Today, while messing around with WriteFreely configuration and logs, I have become aware of the API endpoints. I did know about the API before, but I never set to actually look at what is possible to do.

The most useful open endpoint is probably /api/collections. Every user on a WriteFreely instance has a collection (of posts) associated with its username; in my case, this is /api/collections/nick. Under this path, the /api/collections/nick/posts endpoint retrieves some meta information and the 10 latest posts (if the blog uses the “Blog” display format):

$ curl -s https://blog.nvitucci.social/api/collections/nick/posts

A tool like jq can be useful for a quick inspection from the command line. For example, you can retrieve the title of the blog and the total number of posts with the following command:

$ curl -s https://blog.nvitucci.social/api/collections/nick/posts | jq '.data.title, .data.total_posts'

You can also see the title of the 10 latest posts:

$ curl -s https://blog.nvitucci.social/api/collections/nick/posts | jq '.data.posts[].title'

Since the page size is set to 10 (and apparently it cannot be changed), you can calculate the number of pages and then paginate the result using the page parameter:

$ curl -s https://blog.nvitucci.social/api/collections/nick/posts?page=2 | jq '.data.posts[].title'

The complete documentation of the WriteFreely API is available here.

#TIL #fediverse #API

This should have been the 14th post this year, as I promised to myself I'd write a post per day for at least one month. Obviously, life being unpredictable as well as coincidences existing, the server's hard disk failed before I could take a backup – which I scheduled for this upcoming week. As a result, for now the previous posts are lost. Another lesson for me.

#fediverse #life