Welcome to Yanader's Records. A web-based source of all your favourite records, accessible through our own custom API (CLI coming soon!)
This API currently works without authentication (on trust).
http://localhost:8080/api/v1/recordstore
The base endpoint for this service.
Returns a list of all albums on record.
[
{
"albumId": 1,
"albumName": "Zuma",
"artistName": "Neil Young",
"releaseDate": "1975-11-10",
"genre": "ROCK"
},
...
{
"albumId": 5,
"albumName": "Artpop",
"artistName": "Lady Gaga",
"releaseDate": "2013-11-06",
"genre": "POP"
}
]The API currently only takes one query parameter at a time.
| Name | Description | Type |
|---|---|---|
| name | A list of albums with the specified name. | Text |
| artistname | A list of albums by the specified artist. | Text |
| year | A list of albums released in the given year | Number |
| genre | A list of albums of the given genre | Category (See below) |
| Genres |
|---|
| ROCK |
| POP |
| COUNTRY |
| JAZZ |
| CLASSICAL |
| DANCE |
| SOUL |
Returns a list of in-stock albums.
[
{
"albumId": 1,
"albumName": "Zuma",
"artistName": "Neil young",
"quantity": 2,
"priceInPounds": 15.0
},
{
"albumId": 2,
"albumName": "Close to the edge",
"artistName": "Yes",
"quantity": 3,
"priceInPounds": 17.0
}
]Returns album information based on its id or advises an album doesn't exist.
{
"albumId": 1,
"albumName": "Zuma",
"artistName": "Neil young",
"quantity": 2,
"priceInPounds": 15.0
}{
"status": 404,
"message": "No album with id 3 exists"
}Adds an album into the database. Responds with the same album details or an error message.
{
"albumName": "oh how we drift away",
"artistName": "tim heidecker",
"priceInPence": 1199,
"releaseDate": "2020-09-25",
"genre": "COUNTRY"
}{
"albumId": 6,
"albumName": "oh how we drift away",
"artistName": "tim heidecker",
"releaseDate": "2020-09-25",
"genre": "COUNTRY"
}{
"status": 400,
"message": "Missing Details: albumName, artistName, priceInPence, releaseDate(yyyy-mm-dd), genre(See documentation for list)"
}Updates an existing album with id based on path variable. Requires full body in request
{
"albumName": "Owls",
"artistName": "Owls",
"priceInPence": 1299,
"releaseDate": "2001-07-31",
"genre": "JAZZ"
}{
"albumId": 6,
"albumName": "Owls",
"artistName": "Owls",
"quantity": 1,
"priceInPounds": 12.99
}{
"status": 400,
"message": "Missing Details: albumName, artistName, priceInPence, releaseDate(yyyy-mm-dd), genre(See documentation for list)"
}Deletes album based on path variable
{
"status": 404,
"message": "Deletion failed. No record at id 6"
}Update selected fields on the album id specified in path variable. This endpoint allows any combination of attributes to be included in the body.
{
"priceInPence": 1799
}{
"albumId": 1,
"albumName": "zuma",
"artistName": "neil young",
"releaseDate": "1975-11-10",
"genre": "ROCK"
}{
"status": 404,
"message": "No album with id 10 exists"
}Standard /health endpoint supplied through Spring Actuator via redirect
The codebase is split into a number of packages.
- Repository
- Includes separate repositories for Albums and Stock.
- Implement CrudRepository to supply standard CRUD functionality.
- Model
- Includes entity models for Album and Stock and a number of DTO objects for data transfer to/from the database
- Service
- Business logic drawing on the repository layer and supplying the controller
- Controller
- Endpoint definition with custom exception handling to provide users with detailed responses
- Note: The API often provides priceInPounds for improved customer experience but the Stock repository holds priceInPence as an integer
- Staff Picks!
- After searching for an album ID that doesn't exist, the user will additionally be presented with a staff pick!
- Command Line Interface
- As an alternative to the API, customers will be able to interact with our database through the command line
- Currently under construction on branch "cli"
- Security!
- User profiles will be used to separate customer endpoints from staff endpoints. As a customer you'll be able to query the database as much as you like but only staff will be able to update it.
- Multiple Query Parameters