This week, we are working with APIs and JSON data! You might not be familiar with APIs, but I assure you it’s something that you use & depend on all the time. API stands for Application Programming Interface, and it is basically a medium that allows different applications and platforms to talk to each other. Without APIs, you probably won’t be able to check the weather from your phone, unless the phone company runs a system of weather stations (which would be pretty impressive).
API opens up the possibilities for collaboration and integration of resources; to put this into the context of art, API grants artists and the artwork the ability to connect with the real world. In Art and the API, Jer Thorp suggests that the API offers a tool for artists to work closely and/or within the networked systems that connect and influence billions of people around the world. Because art stems from real life and reflects various ideas and thoughts, the emergence of APIs presents a way for artists and programmers to manipulate and build metaphors upon information that are closely tied to our lives. Storytellers can therefore use APIs to make their stories more convincing and persuasive by referencing live and dynamic sources of information.
I was listening to music when I was thinking about what to make for this week’s assignment, and so I thought… why not make something related to music? At first, I wanted to directly access Spotify’s API; however, Spotify uses OAuth as authentication for their APIs. I decided not to mess around with OAuth at this point, and then I realized that my Spotify is connected to last.fm, which only requires an API key to access their data. I started browsing their documentation and found that I could pull listening histories from any users as long as I know their username. So I decided to make a program that shows what I am listening to currently.
The sketch is linked here, and these are some screenshots taken from the program:
The API was super easy to work with once I got a hang of it; essentially, the JSON file is just an excel sheet formatted in a list form. After I imported the pictures from the API, I figured I’d also make the background color match the album cover. So I used the get() function to get the color of a specific pixel on the picture and loaded that info into the background.
For the midterm, I want to try to make a program that’s capable of showing the user the train arrival time closest to their location. The visual element of the program will be based on an app that I have previously designed.
I will be using class and objects to create buttons and display elements. The program will also involve user input, which I plan to build with a text box from an external library(?).