STAT 39000: Project 11-- Fall 2021

Motivation: One of the primary ways to get and interact with data today is via APIs. APIs provide a way to access data and functionality from other applications. There are 3 very popular types of APIs that you will likely encounter in your work: RESTful APIs, GraphQL APIs, and gRPC APIs. We will address some pros and cons of each, with a focus on the most ubiquitous, RESTful APIs.

Context: This is the fourth in a series of 4 projects focused around APIs. At this point in time there will be varying levels of understanding of APIs, how to use them, and how to write them. One of the "coolest" parts about APIs is how flexible they are. It is kind of like a website, the limitations are close to what you can imagine. Every once in a while we like to write projects that are open ended and allow you to do whatever you want within certain guidelines. This will be such a project.

Scope: Python, APIs, requests, fastapi

Learning Objectives
  • Understand and use the HTTP methods with the requests library.

  • Differentiate between graphql, REST APIs, and gRPC.

  • Write REST APIs using the fastapi library to deliver data and functionality to a client.

  • Identify the various components of a URL.

Make sure to read about, and use the template found here, and the important information about projects submissions here.

Dataset(s)

The following questions will use the following dataset(s):

  • /depot/datamine/data/**

You are free to use any dataset(s) you wish for this project. The only requirement is that there is some data-oriented component to the API you build, and that there is a way for anyone (in the course) to access the data. So easily downloadable datasets, datasets in the data depot, web scraping, etc., are all acceptable.

Questions

Overview

At a high level, this project has 3 parts.

  1. Write an API that does something with data.

  2. Provide a series of images, or a video/screen recording, that demonstrates what your API does.

  3. If, you chose to provide a series of images, provide text that explains what the images are showing, and how your API behaves. If you chose to provide a video/screen recording, a verbal explanation can be used in lieu of text.

If you choose to illustrate your API with images.

Items to submit
  • A jupyter notebook with images and explanations of what you are showing in the images, and what your API is doing. Feel free to write about any struggles you ran into, how you fixed them (or why you couldn’t figure out how to fix them — that is perfectly OK if that happens!).

If you choose to illustrate your API with a video.

Items to submit
  • A video showing off your API and explaining what it does. Feel free to write about any struggles you ran into, how you fixed them (or why you couldn’t figure out how to fix them — that is perfectly OK if that happens!).

  • If your video doesn’t contain audio, include an explain.txt file with a written explanation of what your video is showing.

Part 1

Write an API that does something with data.

Requirements:

  1. The something your API does must be non-trivial. In other words, don’t just regurgitate the data from the dataset. Wrangle the data, recombine it in a useful way, transform it into a graphic, summarize it, etc.

  2. Just put 1 project’s worth of effort into your API. This will vary from student to student, but just show us some effort. We aren’t looking for APIs that are perfect, or (anywhere near) as complicated as the previous projects you’ve worked on — they can be much simpler — especially since you are putting it together from (basically) scratch!

The open-ended nature of this project may frustrate some of you, so we will provide some ideas below that would be accepted for full credit.

  • Build on and add new features to an API from a previous project.

  • Use a feature of fastapi that you haven’t seen before. For example, something like this would be more than enough. (Building on that demo is perfectly acceptable to do for this project too.) Other ideas could be using websockets (using fastapi), graphQL (using fastapi), a form that does something when you submit it, etc (these are all way more than we expect from you).

  • Incorporate other skills you’ve learned previously (like scraping data, for instance) into your API.

  • You could write an API that scrapes the-examples-book.com and gives you the link to the newest 190/290/390 project (or something like that).

  • You could write a middleware that does something with the request and response for one of our previous APIs.

  • You could write an API that scrapes data from purdue.edu/directory and returns something.

  • You could write an API that returns a random "The Office" quote using a dataset in the data depot (this is an example of about the minimum we would expect from your API).

Have fun, be creative, and know that we understand it is a stressful time and we will be lenient and forgiving with grading. This is about trying something new and maybe having some fun and incorporating your own interests into the project. Please feel 100% free to use any of the previous projects as a starting point for your code — we will not consider that "copying" at all.

Part 2

Provide a series of images, or a video/screen recording, that demonstrates what your API does.

If you choose to use images. Submit a Jupyter notebook with images, followed by text, explaining what is in the images. As a reminder, you can insert an image using markdown, as follows.

%%markdown

![](/absolute/path/to/image.png)

Again, this doesn’t need to be perfect, just add enough details so we can get a good idea of what you created.

If you choose to do a screen recording, please add voiceover so you can explain what you are doing while you are doing it. Alternatively, feel free to have a silent video, but please also submit a explain.txt file with a verbal explanation of what your API does.

The final requirement for both the video and image choices are to include a portion where you dig into a critical piece of your code and explain what it does. This is just so we see some of your code and show us you understand it.

On a mac, an easy way to take a screen recording is to type Ctrl+Cmd+5, and then click on the record screen button option on the lower part of your screen. When you want to stop recording push the stop button in the menubar at the top of your screen where the date and time is shown.

On a windows machine, here are some directions.

Part 3

If, you chose to provide a series of images, provide text that explains what the images are showing, and how your API behaves. If you chose to provide a video/screen recording, a verbal explanation can be used in lieu of text.

This was explained in part (2), however, we are reiterating it here.

Please make sure to double check that your submission is complete, and contains all of your code and output before submitting. If you are on a spotty internet connection, it is recommended to download your submission after submitting it to make sure what you think you submitted, was what you actually submitted.