WELCOME TO CINEMA.DATABASE API!

This API provides an interactive database of information on films, directors, and genres.
Additionally, users can register to create and manage a list of their favorite films.

All URL endpoints and their request/response types:

GET /movies

Gets list of all movies in the database

Request body data format:

none

Response body data format:

JSON object with list of all movies with their info

GET /movies/[Title]

Gets data about a single movie in the database, by title

Request body data format:

none

Response body data format:

JSON object with movie info (movie id, description, genre, director, image URL, and whether it's featured or not)

                        
                            {
                                _id: ObjectId,
                                Title: String,
                                Description: String,
                                Genre: {
                                    Name: String,
                                    Description: String
                                },
                                Director: {
                                    Name: String,
                                    Bio: String,
                                    Birth: Date,
                                    Death: Date
                                },
                                ImagePath: String,
                                Featured: Boolean
                            }
                        
                    

GET /users/[Username]

Gets data about a single user in the database, by username

Request body data format:

none

Response body data format:

JSON object with user info (user id, (hashed) password, email, birthday, and favorite movies list)

                        
                            {
                                Username: String,
                                Password: String,
                                Email: String,
                                Birthday: Date,
                                FavoriteMovies: [MovidId]
                            }
                        
                    

GET /movies/genres/[Genre]

Gets data about a genre in the database, by name

Request body data format:

none

Response body data format:

Text message of genre description

GET /movies/directors/[Director]

Gets data about a director in the database, by name

Request body data format:

none

Response body data format:

JSON object with director info (bio, birth year, and death year)

                        
                            {
                                Name: String,
                                Bio: String,
                                Birth: Date,
                                Death: Date
                            }
                        
                    

POST /users

Adds new user to database

Request body data format:

JSON object with username, password, email, and (optionally) birthday

Input verification:

  • Username must be at least 5 characters long and include only alphanumeric characters
  • Password must be at least 8 characters long
  • Email must be a valid email address
  • Birthday must use format MM/DD/YY

                        
                            {
                                Username: String,
                                Password: String,
                                Email: String,
                                Birthday: Date ("mm/dd/yy")
                            }
                        
                    

Response body data format:

JSON object with user id, username, (hashed) password, email, birthday (if present), and favorite movies list (begins empty)

                        
                            {
                                _id: ObjectId,
                                Username: String,
                                Password: String,
                                Email: String,
                                Birthday: Date,
                                FavoriteMovies: [MovieId]
                            }
                        
                    

PUT /users/[Username]

Updates user's info by current username

Request body data format:

JSON object with data about user (username, password, email, and birthday (if present))

Input verification:

  • Username must be at least 5 characters long and include only alphanumeric characters
  • Password must be at least 8 characters long
  • Email must be a valid email address
  • Birthday must use format MM/DD/YY

                        
                            {
                                Username: String,
                                Password: String,
                                Email: String,
                                Birthday: Date ("mm/dd/yy")
                            }
                        
                    

Response body data format:

JSON object with all current data about user after update (user id, username, (hashed) password, email, birthday (if present), favorite movies list)

                        
                            {
                                _id: ObjectId,
                                Username: String,
                                Password: String,
                                Email: String,
                                Birthday: Date,
                                FavoriteMovies: [MovieId]
                            }
                        
                    

POST /users/[Username]/FavoriteMovies/[MovieID]

Adds movie to user's favorites list

Request body data format:

none

Response body data format:

JSON object with data about user (user id, username, (hashed) password, email, birthday (if present), favorite movies list which includes newly added movie id)

                        
                            {
                                _id: ObjectId,
                                Username: String,
                                Password: String,
                                Email: String,
                                Birthday: Date,
                                FavoriteMovies: [MovieId]
                            }
                        
                    

DELETE /users/[Username]/FavoriteMovies/[MovieID]

Removes movie from user's favorites list

Request body data format:

none

Response body data format:

Text message indicating movie was removed

DELETE /users/[Username]

Removes user from database

Request body data format:

none

Response body data format:

Text message indicating user was removed

POST /login

Logs user in, granting them access to the database

Request body data format:

JSON object with username and password

                        
                            {
                                Username: String,
                                Password: String
                            }
                        
                    

Response body data format:

JSON object with data about user (user id, username, (hashed) password, email, birthday (if present), favorite movies list), and newly created JSON web token (JWT)

                        
                            {
                                _id: ObjectId,
                                Username: String,
                                Password: String,
                                Email: String,
                                Birthday: Date,
                                FavoriteMovies: [MovieId]
                            }
                            token: [JWT]