A Spring Boot project (which I created to learn Spring Cloud).
It implements different RESTful endpoints which are explained here.
Javadoc
-
clone repository
-
create PostgreSQL db with 3 DBs (User, Concerts and Playlist)
-
use user.sql, concerts.sql and playlist.sql to create tables in the corresponding DB (files are under the resources folder)
-
setup env variables:
- SONGS_PASSWORD=db_password
- SONGS_HOST=db_ip
- KBE_DB_USER=db_user
- SECRET_KEY_KBE=key_used_to_create_JWT
-
run all mains
- Authorization Microservice
- Song Microservice
- Concert Microservice
- Eureka Microservice
- Gateway Microservice
Endpoints documentation of Song web application.
Authorisation Endpoints.
Get JWT for User 1.
Endpoint:
Method: POST
Type: RAW
URL: http://localhost:8080/songsWS/rest/auth
Body:
{"userId":"mmuster","password":"pass1234"}
Get JWT for User 2.
Endpoint:
Method: POST
Type: RAW
URL: http://localhost:8080/songsWS/rest/auth
Body:
{"userId":"eschuler","password":"pass1234"}
Concert endpoints.
Delete ticket by ID.
Endpoint:
Method: DELETE
Type:
URL: http://localhost:8080/songsWS/rest/tickets/1
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT |
Get concert by ID.
Endpoint:
Method: GET
Type:
URL: http://localhost:8080/songsWS/rest/concerts/1
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT | |
Accept | application/json |
Get Ticket by ID.
Endpoint:
Method: GET
Type:
URL: http://localhost:8080/songsWS/rest/tickets
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT |
Query params:
Key | Value | Description |
---|---|---|
buyConcert | 1 |
Get Ticket QR Code.
Endpoint:
Method: GET
Type:
URL: http://localhost:8080/songsWS/rest/tickets/1
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT |
Get all concerts.
Endpoint:
Method: GET
Type:
URL: http://localhost:8080/songsWS/rest/concerts/
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT | |
Accept | application/json |
Get all tickets for user.
Endpoint:
Method: GET
Type:
URL: http://localhost:8080/songsWS/rest/tickets/
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT | |
Accept | application/json |
Post a new Concert.
Endpoint:
Method: POST
Type: RAW
URL: http://localhost:8080/songsWS/rest/concerts/
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT |
Body:
{
"location": "Berlin",
"artist": "Britney Spears",
"maxTickets": 10
}
Playlists endpoints.
Delete a playlist by ID.
Endpoint:
Method: DELETE
Type:
URL: http://localhost:8080/songsWS/rest/songLists/2
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT |
Get all the playlists from a User, if you own the playlist private and public will be returned else only public.
Endpoint:
Method: GET
Type:
URL: http://localhost:8080/songsWS/rest/songLists
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT | |
Accept | application/json |
Query params:
Key | Value | Description |
---|---|---|
userId | mmuster |
Get a specific playlist by ID.
Endpoint:
Method: GET
Type:
URL: http://localhost:8080/songsWS/rest/songLists/2
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT | |
Accept | application/json |
Post a new Playlist.
Endpoint:
Method: POST
Type: RAW
URL: http://localhost:8080/songsWS/rest/songLists
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT | |
Content-Type | application/json |
Body:
{
"name": "Mmuster's Private Playlist 2",
"isPrivate": true,
"songList": [
{
"id": 4,
"title": "Ghostbusters (I'm not a fraid)",
"artist": "Fall Out Boy, Missy Elliott",
"label": "Ghostbusters",
"released": 2016
},
{
"id": 5,
"title": "Bad Things",
"artist": "Camila Cabello, Machine Gun Kelly",
"label": "Bloom",
"released": 2017
}
]
}
Update a playlist.
Endpoint:
Method: PUT
Type: RAW
URL: http://localhost:8080/songsWS/rest/songLists/5
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT | |
Content-Type | application/json |
Body:
{
"id": 5,
"name": "Mmuster's Public Playlist 2 NEW",
"isPrivate": false,
"songList": [
{
"id": 8,
"title": "No",
"artist": "Meghan Trainor",
"label": "Thank You",
"released": 2016
},
{
"id": 9,
"title": "Private Show",
"artist": "Britney Spears",
"label": "Glory",
"released": 2016
}
]
}
Song service endpoints.
Delete a song from ID.
Endpoint:
Method: DELETE
Type:
URL: http://localhost:8080/songsWS/rest/songs/5
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT |
Get a Song by the ID.
Endpoint:
Method: GET
Type:
URL: http://localhost:8080/songsWS/rest/songs/1
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT | |
Accept | application/json |
Get all songs from given artist.
Endpoint:
Method: GET
Type:
URL: http://localhost:8080/songsWS/rest/songs
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT | |
Accept | application/json |
Query params:
Key | Value | Description |
---|---|---|
artist | Justin Timberlake |
Get all available songs.
Endpoint:
Method: GET
Type:
URL: http://localhost:8080/songsWS/rest/songs/
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT | |
Accept | application/json |
Post a new Song.
Endpoint:
Method: POST
Type: RAW
URL: http://localhost:8080/songsWS/rest/songs/
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT |
Body:
{
"title": "Can’t Stop the Feeling",
"artist": "Justin Timberlake",
"label": "Trolls",
"released": 2016
}
Post a new Song as JSON File.
Endpoint:
Method: POST
Type: FILE
URL: http://localhost:8080/songsWS/rest/songs/
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT |
Update a Song.
Endpoint:
Method: PUT
Type: RAW
URL: http://localhost:8080/songsWS/rest/songs/3
Headers:
Key | Value | Description |
---|---|---|
Authorization | JWT | |
Content-Type | application/json |
Body:
{
"id": 3,
"title": "SONG_TITLE_EDIT",
"artist": "COOL Artitst_EDIT",
"label": "SONY_EDIT",
"released": 2021
}