API Documentation - GaronSmith/marvelous-movies GitHub Wiki
API Documentation
Resources:
- Users
- Movies
- Reviews
- Ratings(working on)
- Actions(not started)[things like 'want to read' and 'watched']
Users
Endpoints for the Users resource:
- Log In ** POST /api/login
- Sign Up ** POST /api/users
- Log Out ** DELETE /api/logout
- Retrieve Single User ** GET /api/users/:id
#Log In
###Logs in an existing user
- POST /api/login
Body Parameters
| Parameter Type | Description | Notes |
email string | email of the user logging in | required
password string | password of the user logging in | required
Returns
Returns a current user object if successful and sets an HTTP-only auth cookie, and returns an error otherwise.
Sign Up
Creates a new user
- POST /api/users
Body Parameters
| Parameter Type | Description | Notes
username string | Desired username of the new user | required
email string | Desired email of the new user | required
password string | Desired password of the new user | required
confirmPassword string | Repeated password of the new user | required, same as password
Returns
Returns a current user object if successful and sets an HTTP-only auth cookie, and returns an error otherwise.
Log Out
Logs out the current user, requires authentication with a cookie
- DELETE /api/logout
Returns
Returns a success message and remove the HTTP-only auth cookie if successful, and returns an error otherwise.
Retrieve Single User
- GET /api/users/:id
Path Parameters
| Parameter Type | Description | Notes |
| id ID | id of the user | required |
Returns
Returns a user object if successful, and returns an error otherwise.
Movie Endpoints:
- Retrieve All Movies
** GET /api/movies
- Retrieve a Single Movie
** GET /api/movies/:id
Retrieve All Movies
retrieves all movies
*GET /api/movies
Query Parameters Filters
| Parameter Type | Description | Notes |
limit number | limit of how many movies 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
genre filter | allows user to filter films by specified genre | optional
rating filter | allows user to filter by star rating | optional
Returns
Returns an array of movies objects if successful, and returns an error otherwise
Retrieve a Single movie
Retrieves a single movie with the specified id
- GET /api/movies/:id
Path Parameters
|Parameter Type | Description |Notes|
id ID | id of the movie to retrieve |required
Returns
Returns a movie object if successful, and returns an error otherwise.
Reviews
Endpoints for the Reviews resource:
- Review a movie
** POST /api/movies/:id/reviews
- Remove review -
** DELETE /api/movies/:id/reviews
Review a movie
POST /api/movies/:id/reviews
Path Parameters
|Parameter Type | Description | Notes |
Id ID | id of the movie to review | required
Returns
Returns the movie review as a movie object with the review key set to the value passed in if successful, and returns an error otherwise.
Delete review
- DELETE /api/movies/:id/reviews
Path Parameters
| Parameter Type | Description | Notes |
id ID | id of the movie to remove review | required |
Returns
Returns the movie with no review as a movie object with the review key removed if successful, and returns an error otherwise.