JSON API

The JSON API is based on JSON Feed, the same format as the JSON versions of the hosted site feeds. Micro.blog adds a few useful fields under an extension named _microblog. A response with posts looks like this:

{
  "title": "Micro.blog - Mentions",
  "home_page_url": "https://micro.blog/mentions",
  "feed_url": "https://micro.blog/posts/mentions",
  "_microblog": {
    "about": "https://micro.blog/about/api"
  },
  "items": [
    {
      "id": 123,
      "author": {
        "name": "Manton Reece",
        "url": "http://manton.org",
        "avatar": "http://www.gravatar.com/avatar/d848ac9a3c64d1b73563895892cb2819?s=96",
        "_microblog": {
          "username": "manton",
          "is_following": true
        }
      },
      "url": "https://micro.blog/manton/123",
      "content_html": "<a href=\"https://micro.blog/manton\">@manton</a> Testing testing, hello world.",
      "date_published": "2017-02-24T15:38:50-06:00",
      "_microblog": {
        "is_deletable": true,
        "is_bookmark": false,
        "date_relative": "3:38 pm"
      }
    }
  ]
}

All request should be sent to: https://micro.blog/

The following endpoints are supported:

  • POST /account/signin β€” Pass email, app_name, and redirect_urlparameters to let the user sign in via a confirmation email. Email help@micro.blog so we can enable this for your app. The user can also generate app tokens under Account β†’ Edit Apps. Web apps should use IndieAuth for sign-in.
  • POST /account/verify β€” Accepts a temporary email sign-in token or an app token and returns an auth token and other details. See this help page about authentication and examples here.
  • GET /posts/all β€” JSON timeline for the signed-in user.
  • GET /posts/mentions β€” JSON mentions for the signed-in user.
  • GET /posts/bookmarks β€” JSON bookmarks for the signed-in user.
  • GET /posts/photos β€” Photos-only timeline for the signed-in user.
  • GET /posts/media β€” Photos + videos timeline for the signed-in user.
  • GET /posts/discover β€” JSON for featured posts.
  • GET /posts/discover/[collection] β€” Emoji collections, e.g. β€œbooks” and β€œmusic”.
  • GET /posts/[username] β€” JSON posts written by the given user.
  • GET /posts/[username]/photos β€” JSON posts for photos from a user, including thumbnail URLs.
  • GET /posts/conversation?id=[id] β€” JSON thread for a reply.
  • GET /posts/check?since_id=[id] β€” Check whether there are new posts in the timeline. The response also includes a suggestion for the number of seconds to wait before polling again.
  • POST /posts/bookmarks β€” Bookmark a post. Pass an id.
  • DELETE /posts/bookmarks/[id] β€” Unbookmark a post. Pass an id.
  • GET /posts/replies β€” Get replies posted by the current user.
  • POST /posts/reply β€” Post a reply to an id with content param.
  • DELETE /posts/[id] β€” Delete one of your posts, replies, or bookmarkss for the given id.
  • POST /users/follow β€” Follow user with username param.
  • POST /users/unfollow β€” Unfollow username.
  • POST /users/report β€” Report username for violating community guidelines.
  • GET /users/is_following?username=[username] β€” Check if you’re following username.
  • GET /users/following/[username] β€” List of users username is following.
  • GET /users/discover/[username] β€” List of users username is following that signed-in user isn’t. The count for this is in discover_count from /posts/[username].
  • GET /users/pins/[username] β€” Get pins for user.
  • POST /users/mute β€” Mute username so you don’t see their posts.
  • GET /users/muting β€” List all of the muted users.
  • POST /users/muting/[id] β€” Modify is_hiding_other_repliesparameter.
  • DELETE /users/muting/[id] β€” Unmute a user.
  • POST /users/push/register β€” Register for push notifications. See this comment on GitHub for details.
  • POST /micropub β€” Posting for a hosted microblog uses the Micropub API. See the documentation for more information about posting.

You should pass an authorization token as an HTTP header. This token can be retrieved via one of the authentication options. This is what sending the HTTP token looks like:

GET /posts/all
Authorization: Bearer 123456789

Note: IDs are 64-bit and unique across all posts, mentions, and bookmarks. Pass count, since_id, and before_id params for paging.

1 Like