Introducing a Microformats API for Books: books-mf2.fly.dev

Featured image for sharing metadata for article

Although I've not read too much lately, I do enjoy reading. As with many things, I like to publish the things I'm reading to my website, using the Micropub standard.

To do this, I usually use IndieBookClub, which requires providing all the metadata for myself. I've been wondering for some time about building a nicer UI for this, likely into IndieBookClub, but also potnetially as its own service, even if I only use it.

As part of my move from my personal Micropub server to using Barry Frost's new server Vibrancy, I've been looking at making sure that I can implement reading functionality through that, too.

Because of the way Vibrancy provides a nice way to retrieve the reply-context for an arbitrary URL, I wanted the abiliy to provide the read-of in the Micropub request as the book's metadata, but there still isn't a readily available API for this.

Fortunately, the Open Library provides a really handy API that we can hook into, so I've now built something to scratch my itch.

Demo

Let's assume that we're excited to read the final book in The Expanse series, Leviathan Falls.

We can take the ISBN 10 or ISBN 13, and put it into the API:

GET https://books-mf2.fly.dev/isbn/9780316332910
{
  "items": [
    {
      "properties": {
        "author": [
          {
            "properties": {
              "name": [
                "James S. A. Corey"
              ],
              "url": [
                "http://www.danielabraham.com/james-s-a-corey/"
              ],
              "photo": {
                "alt": "Picture of James S. A. Corey",
                "value": "https://covers.openlibrary.org/b/id/11112303.jpg"
              }
            },
            "type": [
              "h-card"
            ]
          }
        ],
        "name": [
          "Leviathan Falls"
        ],
        "photo": {
          "alt": "Cover picture of Leviathan Falls",
          "value": "https://covers.openlibrary.org/b/id/11295220.jpg"
        },
        "uid": [
          "isbn:9780316332910"
        ],
        "url": [
          "https://openlibrary.org/books/OL32667399M"
        ]
      },
      "type": [
        "h-book"
      ]
    }
  ]
}

Notice that this includes rich author information, and a cover photo for nicer previews.

Source Code

If you're interested in looking at the code for this, or adding feature requests, check out  jamietanna/books-mf2.

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#microformats #micropub #reading #books-mf2.

Also on: IndieWebCamp logo IndieWeb.xyz logo

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.