Edit a Review
Update and return an existing review.
Require Authentication: true
Require proper authorization: Review must belong to the current user
Request
Method: PUT
Route path: /api/reviews/:reviewId
Headers:
Content-Type: application/json
Body:
{
"review": "This was an awesome spot!",
"stars": 5,
}
Successful Response
Status Code: 200
Headers:
Content-Type: application/json
Body:
{
"id": 1,
"userId": 1,
"spotId": 1,
"review": "This was an awesome spot!",
"stars": 5,
"createdAt": "2021-11-19 20:39:36",
"updatedAt": "2021-11-20 10:06:40"
}
Error Response: Body validation errors
Status Code: 400
Headers:
Content-Type: application/json
Body:
{
"message": "Bad Request", // (or "Validation error" if generated by Sequelize),
"errors": {
"review": "Review text is required",
"stars": "Stars must be an integer from 1 to 5",
}
}
Error response: Couldn't find a Review with the specified id
Edit a Review Update and return an existing review.
Require Authentication: true
Require proper authorization: Review must belong to the current user
Request
Method: PUT
Route path: /api/reviews/:reviewId
Headers:
Content-Type: application/json Body:
{ "review": "This was an awesome spot!", "stars": 5, } Successful Response
Status Code: 200
Headers:
Content-Type: application/json Body:
{ "id": 1, "userId": 1, "spotId": 1, "review": "This was an awesome spot!", "stars": 5, "createdAt": "2021-11-19 20:39:36", "updatedAt": "2021-11-20 10:06:40" } Error Response: Body validation errors
Status Code: 400
Headers:
Content-Type: application/json Body:
{ "message": "Bad Request", // (or "Validation error" if generated by Sequelize), "errors": { "review": "Review text is required", "stars": "Stars must be an integer from 1 to 5", } } Error response: Couldn't find a Review with the specified id
Status Code: 404
Headers:
Content-Type: application/json Body:
{ "message": "Review couldn't be found" }