<name of application here>
All endpoints that require a current user to be logged in.
Error Response: Require authentication
{
"message": "Authentication required",
"statusCode": 401
}
All endpoints that require authentication and the current user does not have the correct role(s) or permission(s).
Error Response: Require proper authorization
{
"message": "Forbidden",
"statusCode": 403
}
Returns the information about the current user that is logged in.
Require Authentication: true
Request
Successful Response
{
"id": 1,
"firstName": "John",
"lastName": "Smith",
"email": "john.smith@gmail.com",
"username": "JohnSmith"
}
Logs in a current user with valid credentials and returns the current user's information.
Require Authentication: false
Request
{
"email": "john.smith@gmail.com",
"password": "secret password"
}
Successful Response
{
"id": 1,
"firstName": "John",
"lastName": "Smith",
"email": "john.smith@gmail.com",
"username": "JohnSmith",
"token": ""
}
Error Response: Invalid credentials
{
"message": "Invalid credentials",
"statusCode": 401
}
Error response: Body validation errors
{
"message": "Validation error",
"statusCode": 400,
"errors": {
"email": "Email is required",
"password": "Password is required"
}
}
Creates a new user, logs them in as the current user, and returns the current user's information.
Require Authentication: false
Request
{
"firstName": "John",
"lastName": "Smith",
"username": "JohnSmith",
"email": "john.smith@gmail.com",
"password": "secret password"
}
Successful Response
{
"id": 1,
"firstName": "John",
"lastName": "Smith",
"username": "JohnSmith",
"email": "john.smith@gmail.com",
"token": ""
}
Error response: User already exists with the specified email
{
"message": "User already exists",
"statusCode": 403,
"errors": {
"email": "User with that email already exists"
}
}
Error response: User already exists with the specified username
{
"message": "User already exists",
"statusCode": 403,
"errors": {
"username": "User with that username already exists"
}
}
Error response: Body validation errors
{
"message": "Validation error",
"statusCode": 400,
"errors": {
"email": "Invalid email",
"username": "Username is required",
"firstName": "First Name is required",
"lastName": "Last Name is required"
}
}
Returns all the songs.
Require Authentication: false
Request
Successful Response
{
"Songs":[
{
"id": 1,
"userId": 1,
"albumId": 1,
"title": "Yesterday",
"description": "A song about the past.",
"url": "audio url",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36",
"previewImage": "image url"
}
]
}
Returns all the songs created by the current user.
Require Authentication: true
Request
Successful Response
{
"Songs": [
{
"id": 1,
"userId": 1,
"albumId": 1,
"title": "Yesterday",
"description": "A song about the past.",
"url": "audio url",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36",
"previewImage": "image url"
}
]
}
Returns the details of a song specified by its id.
Require Authentication: false
Request
Successful Response
{
"id": 1,
"userId": 1,
"albumId": 1,
"title": "Yesterday",
"description": "A song about the past.",
"url": "audio url",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36",
"previewImage": "image url",
"Artist": {
"id": 1,
"username": "JohnSmith",
"previewImage": "image url"
},
"Album": {
"id": 1,
"title": "Time",
"previewImage": "image url"
}
}
Error response: Couldn't find a Song with the specified id
{
"message": "Song couldn't be found",
"statusCode": 404
}
Creates and returns a new song.
Require Authentication: true
Require proper authorization: Album must belong to the current user
Request
{
"title": "Yesterday",
"description": "A song about the past.",
"url": "audio url",
"imageUrl": "image url"
}
Successful Response
{
"id": 1,
"userId": 1,
"albumId": 1,
"title": "Yesterday",
"description": "A song about the past.",
"url": "audio url",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36",
"previewImage": "image url"
}
Error Response: Body validation error
{
"message": "Validation Error",
"statusCode": 400,
"errors": {
"title": "Song title is required",
"url": "Audio is required"
}
}
Error response: Couldn't find an Album with the specified id
{
"message": "Album couldn't be found",
"statusCode": 404
}
Updates and returns an existing song.
Require Authentication: true
Require proper authorization: Song must belong to the current user
Request
{
"title": "Yesterday",
"description": "A song about the past.",
"url": "audio url",
"imageUrl": "image url"
}
Successful Response
{
"id": 1,
"userId": 1,
"albumId": 1,
"title": "Yesterday",
"description": "A song about the past.",
"url": "audio url",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-20 20:00:00",
"previewImage": "image url"
}
Error Response: Body validation error
{
"message": "Validation Error",
"statusCode": 400,
"errors": {
"title": "Song title is required",
"url": "Audio is required"
}
}
Error response: Couldn't find a Song with the specified id
{
"message": "Song couldn't be found",
"statusCode": 404
}
Deletes an existing song.
Require Authentication: true
Require proper authorization: Song must belong to the current user
Request
Successful Response
{
"message": "Successfully deleted",
"statusCode": 200
}
Error response: Couldn't find a Song with the specified id
{
"message": "Song couldn't be found",
"statusCode": 404
}
Returns all the Albums.
Require Authentication: false
Request
Successful Response
{
"Albums": [
{
"id": 1,
"userId": 1,
"title": "Time",
"description": "An album about time.",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36",
"previewImage": "image url"
}
]
}
Returns all the Albums created by the current user.
Require Authentication: true
Request
Successful Response
{
"Albums":[
{
"id": 1,
"userId": 1,
"title": "Time",
"description": "An album about time.",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36",
"previewImage": "image url"
}
]
}
Returns the details of an album specified by its id.
Require Authentication: false
Request
Successful Response
{
"id": 1,
"userId": 1,
"title": "Time",
"description": "An album about time.",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36",
"previewImage": "image url",
"Artist": {
"id": 1,
"username": "JohnSmith",
"previewImage": "image url"
},
"Songs": [
{
"id": 1,
"userId": 1,
"albumId": 1,
"title": "Yesterday",
"description": "A song about the past.",
"url": "audio url",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36",
"previewImage": "image url"
}
]
}
Error response: Couldn't find an Album with the specified id
{
"message": "Album couldn't be found",
"statusCode": 404
}
Creates and returns a new album.
Require Authentication: true
Request
{
"title": "Time",
"description": "An album about time.",
"imageUrl": "image url"
}
Successful Response
{
"id": 1,
"userId": 1,
"title": "Time",
"description": "An album about time.",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36",
"previewImage": "image url"
}
Error Response: Body validation error
{
"message": "Validation Error",
"statusCode": 400,
"errors": {
"title": "Album title is required"
}
}
Updates and returns an existing album.
Require Authentication: true
Require proper authorization: Album must belong to the current user
Request
{
"title": "Time",
"description": "An album about time.",
"imageUrl": "image url"
}
Successful Response
{
"id": 1,
"userId": 1,
"title": "Time",
"description": "An album about time.",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-20 20:00:00",
"previewImage": "image url"
}
Error Response: Body validation error
{
"message": "Validation Error",
"statusCode": 400,
"errors": {
"title": "Album title is required"
}
}
Error response: Couldn't find an Album with the specified id
{
"message": "Album couldn't be found",
"statusCode": 404
}
Deletes an existing album.
Require Authentication: true
Require proper authorization: Album must belong to the current user
Request
Successful Response
{
"message": "Successfully deleted",
"statusCode": 200
}
Error response: Couldn't find an Album with the specified id
{
"message": "Album couldn't be found",
"statusCode": 404
}
Returns all the comments that belong to a song specified by id.
Require Authentication: false
Request
Successful Response
{
"Comments": [
{
"id": 1,
"userId": 1,
"songId": 1,
"body": "I love this song!",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36" ,
"User": {
"id": 1,
"username": "JohnSmith"
},
}
]
}
Error response: Couldn't find a Song with the specified id
{
"message": "Song couldn't be found",
"statusCode": 404
}
Create and return a new comment for a song specified by id.
Require Authentication: true
Request
{
"body": "I love this song!"
}
Successful Response
{
"id": 1,
"userId": 1,
"songId": 1,
"body": "I love this song!",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36" ,
}
Error Response: Body validation errors
{
"message": "Validation error",
"statusCode": 400,
"errors": {
"body": "Comment body text is required"
}
}
Error response: Couldn't find a Song with the specified id
{
"message": "Song couldn't be found",
"statusCode": 404
}
Update and return an existing comment.
Require Authentication: true
Require proper authorization: Comment must belong to the current user
Request
{
"body": "I love this song!"
}
Successful Response
{
"id": 1,
"userId": 1,
"songId": 1,
"body": "I love this song!",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-20 20:00:00"
}
Error Response: Body validation errors
{
"message": "Validation error",
"statusCode": 400,
"errors": {
"body": "Comment body text is required",
}
}
Error response: Couldn't find a Comment with the specified id
{
"message": "Comment couldn't be found",
"statusCode": 404
}
Delete an existing comment.
Require Authentication: true
Require proper authorization: Comment must belong to the current user
Request
Successful Response
{
"message": "Successfully deleted",
"statusCode": 200
}
Error response: Couldn't find a Comment with the specified id
{
"message": "Comment couldn't be found",
"statusCode": 404
}
Returns the details of an artist specified by their id.
Require Authentication: false
Request
Successful Response
{
"id": 1,
"username": "JohnSmith",
"totalSongs": 10,
"totalAlbums": 2,
"previewImage": "image url"
}
Error response: Couldn't find an Artists with the specified id
{
"message": "Artist couldn't be found",
"statusCode": 404
}
Returns all the songs created by the specified artist.
Require Authentication: false
Request
Successful Response
{
"Songs": [
{
"id": 1,
"userId": 1,
"albumId": 1,
"title": "Yesterday",
"description": "A song about the past.",
"url": "audio url",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36",
"previewImage": "image url"
}
]
}
Error response: Couldn't find an Artist with the specified id
{
"message": "Artist couldn't be found",
"statusCode": 404
}
Returns all the albums created by the specified artist.
Require Authentication: false
Request
Successful Response
{
"Albums": [
{
"id": 1,
"userId": 1,
"title": "Time",
"description": "An album about time.",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36",
"previewImage": "image url"
}
]
}
Error response: Couldn't find an Artist with the specified id
{
"message": "Artist couldn't be found",
"statusCode": 404
}
Returns all the playlists created by the specified artist.
Require Authentication: false
Request
Successful Response
{
"Playlists": [
{
"id": 1,
"userId": 1,
"name": "Current Favorites",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36",
"previewImage": "image url"
}
]
}
Error response: Couldn't find an Artist with the specified id
{
"message": "Artist couldn't be found",
"statusCode": 404
}
Creates and returns a new playlist.
Require Authentication: true
Request
{
"name": "Current Favorites",
"imageUrl": "image url"
}
Successful Response
{
"id": 1,
"userId": 1,
"name": "Current Favorites",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36",
"previewImage": "image url"
}
Error Response: Body validation error
{
"message": "Validation Error",
"statusCode": 400,
"errors": {
"name": "Playlist name is required"
}
}
Add a song to a playlist specified by the playlist's id.
Require Authentication: true
Require proper authorization: Playlist must belong to the current user
Request
{
"songId": 1
}
Successful Response
{
"id": 1,
"playlistId": 1,
"songId": 1
}
Error response: Couldn't find a Playlist with the specified id
{
"message": "Playlist couldn't be found",
"statusCode": 404
}
Error response: Couldn't find a Song with the specified id
{
"message": "Song couldn't be found",
"statusCode": 404
}
Returns the details of a playlist specified by its id.
Require Authentication: false
Request
Successful Response
{
"id": 1,
"userId": 1,
"name": "Current Favorites",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36",
"previewImage": "image url",
"Songs": [
{
"id": 1,
"userId": 1,
"albumId": 1,
"title": "Yesterday",
"description": "A song about the past.",
"url": "audio url",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36",
"previewImage": "image url"
}
]
}
Error response: Couldn't find a Playlist with the specified id
{
"message": "Playlist couldn't be found",
"statusCode": 404
}
Updates and returns an existing playlist.
Require Authentication: true
Require proper authorization: Playlist must belong to the current user
Request
{
"name": "Current Favorites",
"imageUrl": "image url"
}
Successful Response
{
"id": 1,
"userId": 1,
"name": "Current Favorites",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-20 20:00:00",
"previewImage": "image url"
}
Error Response: Body validation error
{
"message": "Validation Error",
"statusCode": 400,
"errors": {
"name": "Playlist name is required"
}
}
Error response: Couldn't find a Playlist with the specified id
{
"message": "Playlist couldn't be found",
"statusCode": 404
}
Deletes an existing playlist.
Require Authentication: true
Require proper authorization: Playlist must belong to the current user
Request
Successful Response
{
"message": "Successfully deleted",
"statusCode": 200
}
Error response: Couldn't find a Playlist with the specified id
{
"message": "Playlist couldn't be found",
"statusCode": 404
}
Returns all the playlists created by the current user.
Require Authentication: true
Request
Successful Response
{
"Playlists":[
{
"id": 1,
"userId": 1,
"name": "Current Favorites",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36",
"previewImage": "image url"
}
]
}
Return songs filtered by query parameters.
Require Authentication: false
Request
Successful Response
{
"Songs":[
{
"id": 1,
"userId": 1,
"albumId": 1,
"title": "Yesterday",
"description": "A song about the past.",
"url": "audio url",
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-19 20:39:36",
"previewImage": "image url"
}
],
"page": 2,
"size": 25
}
Error Response: Query parameter validation errors
{
"message": "Validation Error",
"statusCode": 400,
"errors": {
"page": "Page must be greater than or equal to 0",
"size": "Size must be greater than or equal to 0",
"createdAt": "CreatedAt is invalid"
}
}