heather-yaple / auth-me-project

Repo for Auth Me project
0 stars 1 forks source link

Add an Image to a Review based on the Review's id #14

Closed heather-yaple closed 1 month ago

heather-yaple commented 2 months ago

Create and return a new image for a review specified by id.

joe-corcoran commented 1 month ago

Add an Image to a Review based on the Review's id Create and return a new image for a review specified by id.

Require Authentication: true

Require proper authorization: Review must belong to the current user

Request

Method: POST

Route path: /api/reviews/:reviewId/images

Headers:

Content-Type: application/json Body:

{ "url": "image url" } Successful Response

Status Code: 201

Headers:

Content-Type: application/json Body:

{ "id": 1, "url": "image url" } 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" } Error response: Cannot add any more images because there is a maximum of 10 images per resource

Status Code: 403

Headers:

Content-Type: application/json Body:

{ "message": "Maximum number of images for this resource was reached" }