-
Notifications
You must be signed in to change notification settings - Fork 0
API Documentation
The Goodlaughs API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes and verbs.
API routes are not user-facing and should only be used by developers.
Resources:
Endpoints for the Reviews resource:
-
Get All Reviews -
GET /api/reviews -
Get a Review -
GET /api/reviews/:id -
Get All Reviews on a Single Laugh -
GET /api/laughs/:id/reviews -
Review a Laugh -
POST /api/laughs/:id/reviews -
Update a Review -
PUT /api/laughs/:id/reviews -
Unreview a Laugh -
DELETE /api/laughs/:idLaugh/reviews/:idReview
Returns all reviews
| Parameter | Type | Description | Notes |
|---|---|---|---|
limit |
number |
limit of how many reviews can be retrieved at one time |
optional, default of 20, max of 100 |
cursor |
number |
a cursor for use in pagination, starting point of the list returned |
optional |
Returns an array of review objects if successful, and returns an error otherwise
Retrieves a single review of the specified id
| Parameter | Type | Description | Notes |
|---|---|---|---|
id |
ID |
id of the review to retrieve |
required |
Returns a review object if successful, and returns an error otherwise.
Retrieves all reviews on a single laugh of the specified laugh id
| Parameter | Type | Description | Notes |
|---|---|---|---|
id |
ID |
id of the laugh |
required |
Returns an array of review objects if successful, and returns an error otherwise.
Creates a review between the current user on the specified laugh id
requires authentication with a cookie
| Parameter | Type | Description | Notes |
|---|---|---|---|
id |
ID |
id of the laugh to review |
required |
Returns a review object if successful, and returns an error otherwise.
Updates a review by the current user on the specified review
requires authentication with a cookie
| Parameter | Type | Description | Notes |
|---|---|---|---|
id |
ID |
id of the laugh to update |
required |
Returns the review as a review object if successful, and returns an error otherwise.
Deletes a specified review by the current user on a specified laugh
requires authentication with a cookie
| Parameter | Type | Description | Notes |
|---|---|---|---|
idLaugh |
ID |
id of the laugh to unreview |
required |
idReview |
ID |
id of the review to unreview |
required |
Returns a success message if successful, and returns an error otherwise.
{
"id": 41,
"body": "Hello World! This is a funny joke.",
"userId": 1,
"laughId": 5,
"createdAt": "2020-10-18T20:26:34.256Z",
"updatedAt": "2020-10-18T20:26:34.256Z"
}