This application does the following:
- Search the artist library of Spotify
- If there’s a result, display it as a list together with a base image if available.
The project technically demonstrate the following:
- Consuming web service
- Basic web service call
- Downloading image from a URL
- Object Oriented Programming – Classes, Inheritance
- LINQ basics
- .NET List object
- Parsing result using JObject using Json.NET
Web Service Basic Concept
If you are not yet familiar with web services. Please read the following article before jumping in to the source code, so you will fully understand what is going on.
Basically, every web service call requires a “REQUEST“ from the sender and a “RESPONSE“ from the receiver. Here, our sender of request is our app – which is requesting artist information , MySpotify while the receiver of our request is the Spotify API.
Object Oriented Programming
We also cover here OOP concept – inheritance. Here – we created two class:
- RESTService – This class is responsible for doing basic web service calls and some helper function like building query string for easier building of URL for calling and downloading images based from a provided URL.
- SpotifyApi – This class is specifically made for calling the Spotify API. It also has sub-class, ArtistModel.
SpotifyApi needed the functionality of the RESTService, RESTService doesn’t need SpotifyApi functions – So here, we will just let SpotifyApi inherits RESTService sub routines and functions, then we will create Subroutines specific for the SpotifyApi requirements.
ArtistModel class is used for storing information about the list of artist. I encourage you doing the same if you need to process a set information.
If you want to learn more about inheritance, visit https://msdn.microsoft.com/en-us/library/ms973803.aspx
Programming Language: VB.NET (Visual Studio 2010)
Source Code: https://github.com/vbp-ph/MySpotify
Note: If you need to integrate with Spotify, there are existing libraries out there that can be use – please use that instead. This project was meant for web service demonstration purpose only.