JSON API -- paging and access to pages?

I’m interested in using micro.blog as a CMS for my website. I’d like to use all the great micro.blog features (fediverse integration, apps, cross-posting, etc), but also programmatically embed the content in my website. I’ve been looking through the info on the JSON API, but it seems like there might be some blockers there.

In order to access the posts, I can either hit the https://micro.blog/posts/<username> endpoint or access the feed at https://username.micro.blog/feed.json. But in both cases, I only get the ‘recent’ (for some value of ‘recent’) items. I don’t see a way to access older items. I would expect to see some sort of page or offset parameter. Briefly glancing over the XML interface, it looks like you can specify the page via XML. Is that just not available in the JSON interface? I’m hoping I missed something.

Likewise, I don’t see any info about accessing a Micro.blog page via the JSON API, but it seems to be accessible via the XML interface. Is this also missing?

If you’re accessing your own posts, you want to use the Micropub API. That is the main API for creating new posts, uploading photos, editing posts, and downloading a list of posts. If you’re building something just for yourself, you can generate an access token under Account → App tokens. That needs to go in an Authorization header when making requests.

As a quick overview, getting posts and paging through them looks something like:

GET https://micro.blog/micropub?q=source&offset=0&limit=50
Authorization: Bearer ABCDEFGH

For more about Micropub, see this help page: Posting API

Or this chapter of the Indie Microblogging book: Micropub · Indie Microblogging

Let us know if you have any questions!

Thanks Manton! This looks like just the right thing I was looking for. Just playing around with the API, I’m able to download ‘page’ entities as well as ‘posts’ with paging. This should let me use micro.blog as a backend pretty easily.

One minor niggle is the need for authentication. Since everything I want to pull is public, is there anyway to access it without an auth token? I could certainly set up some endpoints on something like AWS lambda to wrap calls, but I’d like to avoid the expense and complexity.

Thanks again for the pointers to the Posting API.

Great! No, everything in Micropub right now requires authentication, because there might be draft posts or other private info. It’s an interesting idea to allow unauthenticated requests for public data but that’s not a natural fit for how Micro.blog works right now. We could also look into expanding the data in public feeds.