A music library API and music database created using Java, Spring Boot and SQL for the BNTA back-end API group project.
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
Our team, BlueChickenFM, was given five working days to create a back-end application consisting of an API and database with contents of our choosing. It was required that at a minimum, the API should include GET and POST requests, using Java, Spring and an SQL database. In response to this brief, we created a music API. The database consists of three tables: artists, albums, and songs, each with their own respective classes. The dependencies of the project include Spring Boot and Hikari and Flyway for the database migrations.
The aim of the project is to produce a music library application where users can search a database for songs based on genre, artists, album name, release year and release decade similar to Spotify or Apple Music. The user should be able to access a JSON format set of data about the songs. There should also be the functionality to add new songs, artists and albums into the existing database. The user should also be able to check data about the artists and albums associated with the songs.
To get a local copy of this project up and running follow these simple steps.
- Open Postgres , create a local repository called 'chicken' and connect to it
CREATE DATABASE chicken; \c chicken
-
Clone the repo
git clone https://github.com/zahir679/Project-API.git
-
Open Postgres , create a local repository called 'chicken' and connect to it
CREATE DATABASE chicken; \c chicken
-
Open IntelliJ, go to the ProjectApiApplication class and click Run (green triangle button)
-
Check the Run log at the bottom of the screen. If the program is running, the last two lines of the log should display: ‘Tomcat started on port(s): 8080 (http) with context path '' ‘ ‘Started ProjectApiApplication in x seconds’. The local ‘chicken’ database should also contain the populated ‘songs’, ‘artists’, and ‘albums’ tables.
-
To send requests, use an HTTP API client extension/platform such as Thunder Client or Postman.
-
See 'HTTP Requests' section for HTTP requests and their respective paths
The general format for the JSON objects are as below.
{ "id": 1, "song_name": "My Luv", "genre": "K-pop", "duration": 180, "artist_id": 118, "album_id": 118, "release_date": "2018-09-15", "languages": "Korean", "platform": "Spotify" },
{ "id": 1, "album_name": "Views", "artist_id": 1, "genre": "Hip-Hop", "release_date": "2016-04-29", "number_of_tracks": 20 },
{ "id": 1, "artist_name": "Drake", "nationality": "Canadian", "biggest_hit": "One Dance" }
The following table describes all the paths for the HTTP requests and their respective functionalities.
| HTTP Request Path | Request Type | Description |
|---|---|---|
| http://localhost:8080/api/v1 | GET | Base path (...) - same for all the following requests |
| .../songs | GET | Get all songs |
| .../songs/{id} | GET | Get a single song by song id |
| PUT | Update a song by id | |
| DELETE | Delete a song by id | |
| .../songs/name/{name} | GET | Get song by song name |
| .../songs/artist/{artist_id} | GET | Get songs by artist id |
| .../songs/artist_name/{artists_name} | GET | Get song by artist name |
| .../songs/album/{album_id} | GET | Get songs by album id |
| .../songs/album_name/{album_name} | GET | Get songs by album name |
| .../songs/genre/{genre} | GET | Get songs by genre |
| .../songs/year/{release_year} | GET | Get songs by release year |
| .../songs/decade/{release_decade} | GET | Get songs by release decade |
| .../songs/genre_decade/{genre}/{release_decade} | GET | Get songs by genre and decade |
| .../songs/add | POST | Add a new song |
| .../artists | GET | Get all artists |
| .../artists/{id} | GET | Get a single artist by id |
| PUT | Update an album | |
| DELETE | Delete an album | |
| .../artists/name/{name} | GET | Get artists by name |
| .../artists/nationality/{nationality} | GET | Get artists by nationality |
| .../artists//biggest_hit/{biggest_hit} | GET | Get artists by biggest hit |
| .../artists/add | POST | Add an artist |
| .../albums | GET | Get all albums |
| .../albums/{id} | GET | Get album by id |
| PUT | Update an album | |
| DELETE | Delete an album | |
| .../albums/name/{name} | GET | Get albums by name |
| .../albums/artist/{artist_id} | GET | Get artist by artist id |
| .../albums/artist_name/{artist_name} | GET | Get albums by artist name |
| .../albums/genre/{genre} | GET | Get albums by genre |
| .../albums/year/{release_year} | GET | Get albums by release year |
| .../albums/decade/{release_decade} | GET | Get albums by release decade |
| .../albums/genre_decade/{genre}/{release_decade} | GET | Get albums by genre and decade |
| .../albums/add | POST | Add an album |
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Project Link: https://github.com/zahir679/Project-API