Week 5 — Breeds of Terriers
So for this week’s assignment, I worked with API and JSON files to retrieve data from the server.
I originally wanted to create an interface that allows people to enter a zip code, and returns the information of that location using Zippopotam API (http://www.zippopotam.us/). But due to limited experience working with API, I didn’t manage to match the location based on the zip code entered using the API. Here’s a picture of my failed first attempt.
Then I decided to do something easier. So I discovered Dogs API which is based on the Stanford Dogs Dataset. (https://dog.ceo/dog-api/) It allows people to fetch a dog image based on the breed name entered. I chose the subset of terriers dogs and created a simple interaction that allows people to see the breeds’ names of terrier dogs by clicking a button.
An obstacle I encountered was I couldn’t print the list of breeds’ names on the canvas after creating the printBreed function, despite I correctly selected the list as shown in the console.
With a little bit of help from the Professor, I realized I didn’t call printBreed in the draw function, which was why the list wasn’t printed. After changing the printBreed function for spacing adjustment, the list was successfully printed out!
Here’s the code to my super simple (but really tried!) terrier dogs interface:
API Address: https://dog.ceo/api/breeds/list/all
Video Tutorials for this assignment: https://www.youtube.com/playlist?list=PLnkvii1uWBvHG11Cyyvb3rxC5QXi7OMzH