Connor Smyth

{
    "id": 77871,
    "answer": "(Stephen) King",
    "question": "He worked in a laundry to help pay the bills, at least until \"Carrie\" took off in 1974",
    "value": 600,
    "airdate": "2013-12-26T12:00:00.000Z",
    "air_date": "2013-12-26",
    "category_id": 17462,
    "category": {
        "id": 17462,
        "name": "the pauper"
    }
}
                

Trivia API

GitHub repository Documentation

96,221 Questions

I started creating this trivia API when I decided to create a trivia slack app. At first I was leveraging a different API that contained only user submitted questions. The issue I found with it was it had only the option for true or false questions or multiple choice. I wanted something that was more of along the lines of single question and single answer. I didn't want the question not to work without the other multiple choice options.

I began looking around for a different trivia api and came across jService.io, a ruby based trivia API with 156,800 questions built by scraping jArchive. After poking around a little I discovered that it was being hosted on a simple heroku server with many outdated Ruby dependencies. I attempted to replicate the Ruby environment on my local machine and a simple Linode server with no success, even with rvm. I noticed the developer hasn't had much of an online presence in the last 5 years so after attempting to reach out with and receiving no response I decided to create my own trivia API.

Upon noticing that jService kept track of questions marked as invalid and also had many questions with empty questions or answers fields. I built a quick PHP script and began scraping away. I then created another PHP script after evaluating the state of the database and cleaned up the invalid questions and sent it to a developer/mentor friend who was curious, Jordana Harrison. They helped me do some further cleaning and created a new table that handled the relationships between the category names and the category IDs.

Then I started to create the API with Laravel. I am a big fan of the open source movement so I didn't want to bog people down with having to use API keys, similar to the way jService works. The API is free and open to the public.