Ben Nour

Introducing Archer API

Introducing Archer API, a REST API based on one of my favourite shows, the adult animated spy comedy Archer.

Archer API provides JSON data about Archer's episodes, charactes and quotes.

For example, to get a random quote you can access the archerapi.com/api/quotes/random endpoint:

{
    "character": "Sterling Malory Archer",
    "episode": "Mole Hunt",
    "id": 10,
    "quote": "Just the tip!"
}

Data source/collection

I pulled the data for this API from two sources:

  • IMDb, for episode metadata (episode name, season, airdate, etc)
  • Archer Fandom, for everything else (character names, jobs, voice actor, etc)

For both sources I used Python to get the data. I used the fantastic cinemagoer to access IMDb data and the requests and BeautifulSoup packages for scraping/parsing Archer Fandom.

I then insert this data into a SQLite database. I chose SQLite primarily because Python has inbuilt support for it with their sqlite module and it can be embedded directly in an application.

Data transformation

Using Dbeaver, I connected to the SQLite database and did all of my data transformation and cleaning directly in the database.

As Archer Fandom is maintained by fans there was some inconsistency with the spelling of actor names, the use of Roman numerals vs integers for multiple-part episodes (Heart of Archness: Part II vs Heart of Archness: Part 2) and so on.

Building and hosting the API

I built the API using Flask. This was my first time using this framework and I was really impressed with the documentation and how simple it was to get it up and running.

I hosted the Flask application using Heroku. Again, this was my first time using Heroku and I'll definitely be using it again with future projects.

For the front-end of my website I used a Boostrap template, the HTML of which I modified to add some custom styling and other stuff, like a Google Analytics tag.

You can read the full source code for this project in my Github repo.

Comments !