Skip to main content


Get replies/reblogs/favourites count via uri


!Friendica Support
If I have the URI of a post (e.g. https://monrepos.casa/objects/0e03068e-3466-3cb4-8207-08c267219144) and retrieve it via a JSON API call, I get the ActivityPub representation of that post. This does not include the replies/reblogs/favourites count.

If I retrieve the post through the Mastodon-compatible API, using its local id (e.g. https://monrepos.casa/api/v1/statuses/342306) I will get the counts, as well as the URI.

But if I'm starting with the URI, how do I get the local id to then call that API?

Friendica Support reshared this.

in reply to Gordon Pedersen

Put another way: what can I do to convert a post's diaspora:guid value into a local id compatible with the Mastodon API?

Friendica Support reshared this.

in reply to Gordon Pedersen

@Gordon Pedersen The identifier you're looking for is called uri-id, it's a numerical representation of all the URIs that are recorded by a Friendica node. Every post has one, as well as all contacts, etc...

The item-uri table actually makes the correlation between a guid and a uri-id.

in reply to Hypolite Petovan

@Hypolite Petovan
Is there any API I can use to access that correlation? Or is it only possible to figure out within Friendica itself?

Friendica Support reshared this.

in reply to Gordon Pedersen

@Gordon Pedersen I expect the search endpoint (/api/v2/search) to return the post object including its identifier. Just use the remote post URL as search string. Here's the documentation for it: docs.joinmastodon.org/methods/…
in reply to Gordon Pedersen

@Gordon Pedersen By the way, I love your profile picture, I played a ton of Tiny Tower by Nimblebit! 😄
in reply to Hypolite Petovan

@Hypolite Petovan
I'm experimenting with showing the counts on my personal blog.
deathau.weblog.lol/
If you click the icon on the top right (or any "Interact on the Fediverse" link) then enter your handle, the page should refresh and show counts on posts.

Friendica Support reshared this.

in reply to Gordon Pedersen

@Gordon Pedersen Oh, I see, definitely an interesting feature, although as you've found out, there's no reference to the uri-id in the public ActivityPub representation of a post.

@Michael Vogel What are the risks of including the uri-id of a post in the /objects/ output?

in reply to Hypolite Petovan

There is no field for that in the protocol. Also it is a value that is different for each system. I would prefer some change in the API instead.
in reply to Michael Vogel

@Michael Vogel @Gordon Pedersen We're already exposing the non-standard diaspora:guid field.

The alternative seems to start accepting a URL as a parameter for the /api/v1/statuses/ API endpoint, before it's converted to uri-id.

in reply to Hypolite Petovan

The guid doesn't change between the systems. Also it is needed for the Diaspora communication. But using the search should should work.
in reply to Michael Vogel

@Michael Vogel @Gordon Pedersen We do check the authentication token for the search, which requires an account on the remote system you're probing for interaction counts.