MackHalliday / play-play-express

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

User Story 7 - User can add a new playlist #19

Closed MackHalliday closed 4 years ago

MackHalliday commented 4 years ago

As a user, I can make a POST request to the endpoint /api/v1/playlists. In the body of the POST request, I must include a UNIQUE playlist title. If the POST request is successful, I see a JSON response with newly posted playlist record 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.

See requirements below with specific requirements for request and response.

Request

POST /api/v1/playlists
Content-Type: application/json
Accept: application/json
body:
{
  "title": "Dance Party"
}

Successful Response

status: 201

{
  "id": 1,
  "title": "Cleaning House",
  "createdAt": 2019-11-26T16:03:43+00:00,
  "updatedAt": 2019-11-26T16:03:43+00:00,
}

Unsuccessful Response

status: 400

 {
  "error": "Playlist already exist. Please enter a unique playlist title. "
 }
MackHalliday commented 4 years ago

Deployed to heroku