Documentation for Movie API

Project Description

This project was created by Patrick Gannon as part of the Full Stack Web Development program at CareerFoundry.

Project Objective

The objective of the project as stated in the CareerFoundry Achievement 2 Project Brief is:

"To build the server-side component of a “movies” web application. The web application will provide users with access to information about different movies, directors, and genres. Users will be able to sign up, update their personal information, and create a list of their favorite movies."

Essential Requirements

Endpoints

Endpoint Number Request URL HTTP Method Request Body Data Format Response Body Data Format
Return a list of ALL MOVIES to the user. /Movies GET None A JSON object holding a list of all movies in database. Sample:
                    
                        {Title: 'Movie Title',
                        Description: 'Description of Movie.',
                        Genre: {
                            Name: 'Name of Genre',
                            Description: 'Description of Genre.'
                        },
                        Director: {
                            Name: 'Name of Director',
                            Bio: 'Bio of Director.',
                            Birth: 'Year',
                            Death: 'Year'
                        },
                        ImagePath: 'image.png',
                        Actors: [ 'Actor Name 1', 'Actor Name 2' ],
                        Featured: Boolean
                        }
                    
Return data (description, genre, director, image URL, etc.) about a SINGLE MOVIE to the user after searching by movie title. /Movies/:Title GET None A JSON object holding data (description, genre, director, image URL, whether it’s featured or not) about a single movie title. Sample:
                            
                                {Title: 'Movie Title',
                                Description: 'Description of Movie.',
                                Genre: {
                                    Name: 'Name of Genre',
                                    Description: 'Description of Genre.'
                                },
                                Director: {
                                    Name: 'Name of Director',
                                    Bio: 'Bio of Director.',
                                    Birth: 'Year',
                                    Death: 'Year'
                                },
                                ImagePath: 'image.png',
                                Actors: [ 'Actor Name 1', 'Actor Name 2' ],
                                Featured: Boolean
                                }
                            
Return data about a GENRE (description) after searching by name/title (e.g., "Drama"). /Movies/Genre/:Name GET None A JSON object holding data (description) about a single genre by name. Sample:
                            
                                {
                                    "Genre": {
                                        "Name": "Genre Name",
                                        "Description": "Description of Genre."}
                                }
                            
                        
Return data about a DIRECTOR (bio, birth year, death year) after searching by name. /Movies/Director/:Name GET None A JSON object holding data (bio, birth year, death year) about a director by name. Sample:
                            
                                {
                                    "Director": {
                                        "Name": "Quentin Tarantino",
                                        "Bio": "Quentin Jerome Tarantino is an American film director, screenwriter, producer, and actor.",
                                        "Birth": 1963}
                                }
                            
                        
Add new user / NEW USER REGISTRATION. /Users POST A JSON object holding data about the user. Sample structure:
                            
                                {
                                    "Username": "testuser4",
                                    "Password": "passthisword",
                                    "Email": "nota.real@email.com",
                                    "Birthday": "2024-03-14",
                                }
                            
                        
A JSON object holding data about the new user, including the assigned user ID. Sample:
                            
                                {
                                    "Username": "testuser4",
                                    "Password": "passthisword",
                                    "Email": "nota.real@email.com",
                                    "Birthday": "2024-03-14T00:00:00.000Z",
                                    "FavoriteMovies": [],
                                    "_id": "65f48fa3b8801a55f1643686",
                                }
                            
                        
Allow users to UPDATE their USER INFO (username, email) /users/:Username PUT A JSON object object holding data with the requested updated user info. Sample:
                            
                                {
                                    "Username": "NewName9",
                                    "Email": "updated@email.com",
                                }
                            
                        
A JSON object displaying the updated User information. Sample:
                            
                                {
                                    "_id": "user id number",
                                    "Username": "NewName9",
                                    "Password": "HASHED",
                                    "Email": "updated@email.com",
                                    "Birthday": "Year/Month/Day",
                                    "FavoriteMovies": []
                                }
                            
                        
Allow users to ADD a MOVIE TO their LIST OF FAVORITES /users/:Username/movies/:MovieID POST None. Info retrieved from request parameters. A JSON object displaying the users' updated Favorite Movies List. Sample:
                            {
                                "Username": "UserName",
                                "Email": "new@newemail.com",
                                "FavoriteMovies": [ "65f09105401e816cfbf7a738" ]
                                }
                            
                        
Allow users to REMOVE a MOVIE FROM their LIST OF FAVORITES /users/:Username/movies/:MovieID DELETE None. Info retrieved from request parameters. A JSON object displaying the users' updated Favorite Movies List. Sample:
                            {
                                "Username": "UserName",
                                "Email": "new@newemail.com",
                                "FavoriteMovies": [  ]
                                }
                            
                        
Allow existing USER to DEREGISTER /users/:Username DELETE None A message confirming the user has been successfully removed.