MackHalliday / play-play-express

API with CRUD functionality for favorite tracks and playlists. Uses MusixMatch API
1 stars 0 forks source link

User Story 4 - User can add a new favorite #4

Closed joshsherwood1 closed 4 years ago

joshsherwood1 commented 4 years ago

As a user, I can make a POST request to the endpoint api/v1/favorites. In the body of the POST request, I must include a song title and can optionally include an artist. If the POST request is successful, I see a JSON response with newly posted record for the song and a 201 status. If the user submit invalid information in the POST request body, I should receive a 400 status code and receive a JSON response error message.

This endpoint uses MusixMatch API to get song information using song and optionally artist passed in the POST body request. See requirements below with specific requirements for request and response.

Request

POST /api/v1/favorites
Content-Type: application/json
Accept: application/json
body:
{
  "title": "We Will Rock You"
}

Successful Response

status: 201

{
  "id": 1,
  "title": "We Will Rock You",
  "artistName": "Queen"
  "genre": "Rock",
  "rating": 88
}

Unsuccessful Response

status: 400

 {
  "message": "Song does not exist"
 }
MackHalliday commented 4 years ago

Solo spike completed.

MackHalliday commented 4 years ago

Deployed to Heroku!