Banned Prison Books API - feedback

Hi everyone,

This weekend I was able to deploy a project called Banned Prison Books API. It’s a JSON API for banned texts in prison systems throughout the United States. I wanted to work on this project after talking with a friend about trouble they had sending books to an incarcerated family member, and I realized I knew nothing about censorship in prisons. When a dataset was released, I felt like an API would make the information easier to access.

You can check it out here: https://banned-prison-books-api.onrender.com/
GitHub: GitHub - tespin/banned-prison-books-api: A JSON API for books banned in prisons within the United States.

You can retrieve all books (almost 50,000 entries) or query by publication title, author, year the book was banned, the reason for the ban (if one was provided by the relevant Department of Corrections), or the 2-letter abbreviation of the state it was banned in. You can also combine queries, like so:

GET https://banned-prison-books-api.onrender.com/api/v1/books?publication=dragons&year=2004&reason=security

Design-wise I’m trying to go for a vibe that evokes literature / trustworthiness, so I picked a monospace font and am leaning on the emojis for color.

I’m still working on it, including reference docs, but would love input from the community since it’s my first time developing an API. If anyone has questions on how the project works / what certain sections of code do I’m happy to explain that as well.

Also for anyone wants to learn more about this issue and some of the inconsistencies around censorship in prisons, here is some reporting that accompanied the dataset I used:

Cheers! Hope everyone is having a lovely New Year.

1 Like

Great idea for this application, definitely seems useful! I didn’t know book censorship was a thing in US prisons, trying to find out if that’s also the case here (Belgium) but it doesn’t seem like it.

Anyway, back to your API. Some first thoughts:

  • Could you also include the ISBN number? As that seems like the de facto identifier for books.
  • If you are planning on building an actual front-end for this (or letting someone else build that), a ‘get by ID’ endpoint will most likely be needed.
  • It feels weird to pass "status": "OK" in the response body. I feel in most API’s, this information is passed via the response status code. If you do omit it, it’s also an option to just omit the data property and return the data as the array/object itself.
  • I assume your passing year, month, day in separate keys because you want to be able to easily filter on the year of publication? Perhaps month and day are obsolete then and can be deducted from the date property?
  • I was gonna say that you could perhaps expand the data via external sources (or refer to them) like Goodreads, but it seems they don’t have publicly available API’s anymore :frowning: I don’t see any other good sources at the moment that would have additional data available on large numbers of books, but perhaps it’s something to further investigate.
1 Like

hey @carlos-ds , thanks for the response! I didn’t know it was a thing either; what goes on in prisons doesn’t generally seem to be public knowledge unless you know someone who is incarcerated. The group who released the dataset I used explained that many state prisons did not even keep track of books they’ve banned which is reflected in the data (not every U.S. state is represented).

  • Could you also include the ISBN number? As that seems like the de facto identifier for books.

I agree. Unfortunately there wasn’t an “ISBN” field in the dataset and due to the nature of the data, ISBNs for banned texts were likely not recorded. Also many of the texts in the data are not strictly books and include formats like magazines, periodicals, pornographical content, etc that don’t have ISBNs. Lots of cleanup is needed.

  • If you are planning on building an actual front-end for this (or letting someone else build that), a ‘get by ID’ endpoint will most likely be needed.

Do you mean like the site I linked in the original post? https://banned-prison-books-api.onrender.com/

  • It feels weird to pass "status": "OK" in the response body. I feel in most API’s, this information is passed via the response status code. If you do omit it, it’s also an option to just omit the data property and return the data as the array/object itself.

Ok! Learning about status codes so this pattern is good to know.

  • I assume your passing year, month, day in separate keys because you want to be able to easily filter on the year of publication? Perhaps month and day are obsolete then and can be deducted from the date property?

Agree that month and day don’t feel like useful fields – they are included in the response because that is how they are formatted in the dataset. I’m unsure what the best practices are when designing APIs in a way that diverges from the original data.

  • I was gonna say that you could perhaps expand the data via external sources (or refer to them) like Goodreads, but it seems they don’t have publicly available API’s anymore :frowning: I don’t see any other good sources at the moment that would have additional data available on large numbers of books, but perhaps it’s something to further investigate.

Absolutely. I think the Internet Archive has an API I could use to acquire data like genres, book covers, etc and would love to extend the project in that direction.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.