webmention.io icon indicating copy to clipboard operation
webmention.io copied to clipboard

Document /api/count.json endpoint

Open mxstbr opened this issue 6 years ago • 2 comments

Rendering like and response counts is a pretty common UI pattern on blogs, for example:

screen shot 2019-01-16 at 14 33 49

Right now, to render the counts I have to fetch all pages of webmentions, even if I don't want to show the actual webmentions until the person clicks on the "XYZ responses", nevermind paginating them.

It would be awesome if the API had an endpoint to get the counts of mentions per type for a specific page, for example I imagine something like this:

$ curl https://webmentions.io/api/mention-counts.jf2?target=bla.com
{
  "like-of": 295,
  "in-reply-to": 33,
  "repost-of": "186,
  "mention-of": 41,
  "bookmark-of": 11
}

mxstbr avatar Jan 16 '19 13:01 mxstbr

It's already there, just apparently not in the readme! The endpoint is /api/count.json

aaronpk avatar Jan 16 '19 14:01 aaronpk

That's perfect, thank you!

mxstbr avatar Jan 16 '19 14:01 mxstbr

This has been added to the home page for some time now

https://webmention.io/#display-mention-counter

aaronpk avatar Aug 19 '23 18:08 aaronpk