Before running this API, ensure you have the following software installed:
- Python 3.x
- SQLite (for the database)
-
Clone this and move to the folder where you have cloned it.
-
pip install -r requirements.txt
-
python3 app.py
- Register or log in a user by providing an email and password. The endpoint returns a JWT token for accessing protected endpoints. Movies
curl -X POST -H "Content-Type: application/json" -d '{
"email": "[email protected]",
"password": "password"
}' http://localhost:5000/auth
- Retrieve a list of movies. You can use query parameters to filter and search for movies by name, director, genre, IMDb rating, and popularity.
curl http://localhost:5000/movies
- Add a new movie (authentication required).
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <JWT-access-token>" -d '{
"99popularity": 88.0,
"director": "George Lucas",
"genre": ["Action", "Adventure", "Fantasy", "Sci-Fi"],
"imdb_score": 8.8,
"name": "Star Wars"
}' http://localhost:5000/movies/add
- Edit an existing movie (authentication required) No need to pass all the values if some fields are not passed it will use the previous ones.
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer <JWT-access-token>" -d '{
"99popularity": 89.0,
"director": "George Lucas",
"genre": ["Action", "Adventure", "Sci-Fi"],
"imdb_score": 9.0,
"name": "Star Wars: Updated"
}' http://localhost:5000/movies/edit/<movie_id>
- Remove a movie by ID (authentication required).
curl -X DELETE -H "Authorization: Bearer <JWT-access-token>" http://localhost:5000/movies/remove/<movie_id>
-
Searching Search for movies based on various criteria, including name, director, genre, IMDb rating , and popularity/popularity range.
-
Search Movies by Name
curl "http://localhost:5000/search?name=Star%20Wars"
- Search movies by director:
curl "http://localhost:5000/search?director=George%20Lucas"
- Search movies by multiple genres or a genre:
curl "http://localhost:5000/search?genre=Adventure&genre=Fantasy"
Search movies by IMDb rating range or wih just maximum and minimum:
curl "http://localhost:5000/search?min_rating=8.0&max_rating=9.0"
curl http://localhost:5000/search?max_rating=9.0
curl http://localhost:5000/search?min_rating=8.0
Search movies by popularity range or wih just maximum and minimum:
curl "http://localhost:5000/search?min_popularity=80.0&max_popularity=90.0"
curl "http://localhost:5000/search?min_popularity=80.0
curl "http://localhost:5000/search?max_popularity=80.0