Welcome to the Shows API. Search, sort and filter your favorite Movies and TV Shows. Go to https://netflix-shows-api.herokuapp.com/docs/ to see full list of available endpoints.
- Search: Search shows that contain
Music
in the titlecurl -XGET -H "Content-type: application/json" 'https://netflix-shows-api.herokuapp.com/api/searchShows/by/title?&text=Music&limit=2&offset=0'
- Sort: Search shows that contain
Music
in the description and sort bydate_added
curl -XGET -H "Content-type: application/json" 'https://netflix-shows-api.herokuapp.com/api/searchShows/by/title?&text=Music&sort_by=date_added&limit=2&offset=0'
- Paginate: Search shows that contain
Music
in the description and sort byduration
and go to page 2curl -XGET -H "Content-type: application/json" 'https://netflix-shows-api.herokuapp.com/api/searchShows/by/title?&text=music&sort_by=date_added&limit=10&offset=10'
- Create: Create new show
curl -XPOST -H "Content-type: application/json" -d '{'show_id': '81145629', 'type': 'Movie', 'title': 'Norm of the North: King Sized Adventure', 'director': 'Richard Finn, Tim Maltby', 'cast': 'Alan Marriott, Andrew Toth, Brian Dobson, Cole Howard, Jennifer Cameron, Jonathan Holmes, Lee Tockar, Lisa Durupt, Maya Kay, Michael Dobson', 'country': 'United States, India, South Korea, China', 'date_added': '2020-09-19', 'release_year': '2019', 'rating': 'TV-PG', 'duration': '90 min', 'listed_in': 'Children & Family Movies, Comedies', 'description': 'Before planning an awesome wedding for his grandfather, a polar bear king must take back a stolen artifact from an evil archaeologist first.'}' 'https://netflix-shows-api.herokuapp.com/api/addShow'
- Update: Modify existing show
curl -XPUT -H "Content-type: application/json" -d '{'type': 'TV Show'}' 'https://netflix-shows-api.herokuapp.com/api/modifyShowTypeById/80117401'
- Delete: Remove a show
curl -XDELETE -H "Content-type: application/json" 'https://netflix-shows-api.herokuapp.com/api/deleteShowById/81145628'
- Go to
https://netflix-shows-api.herokuapp.com/docs
to view full list of endpoints.
To run the test cases go to ~/Netflix-Shows/netflix-shows
from your terminal window and type below command. Make sure your Fast API server is running.
$ python unittests.py
If you get requests
module import error make sure you install it using below command.
$ pip3 install requests==2.25.1
Follow below steps to setup your environment locally. You can use also clone dev
branch or use it for reference as other branches have production related changes and dev branch should work if you have docker running.
- Python 3
- Docker/Docker-Compose (Optional)
- All the python dependencies are listed in
requirements.txt
.
- If you have docker/docker-compose installed and running this setup is recommended, otherwise follow non-dockerized setup.
- From your terminal go to main project directory i.e. the Netflix-Shows project directory that contains the
docker-compose.yml
file. - Type
docker-compose up --build
to start the server. You will see docker building the service and starting the Fast API server. - Go to your browser and copy-paste
http://localhost:9001
. If you see a welcome message then you've successfully setup the server and ready to start using the API.
- Create a virtual environment using below command.
$ python3 -m venv venv
- Activate your virtual environment.
$ source/venv/bin/active
- If you are on Windows or need more help with virtual environments follow this link.
- From your terminal go
~/Netflix-Shows/
directory, you should be in the directory that containsrequirements.txt
. - Install all the requirements using below command and make sure your virtual environment is active.
$ pip install requirements.txt
- Start the Fast API server using below command. You should see
$ python main.py
- Go to your browser and copy-paste
http://localhost:9001
. If you see a welcome message then you've successfully setup the server and ready to start using the API.
- This project uses Postgres server hosted on Heroku. You can view the data clip here: https://data.heroku.com/dataclips/llzjpvexielskjurztdntndfttah
- These are setups to setup database locally. Comment the Heroku DB variables in
database.py
and uncomment local DB variables. Once your API server is setup start your Postgresql server. - Go to
~/Netflix-Shows/netflix-shows
and runpython backfill.py
to import all the data into your database.
- Jubin Soni
- jubinsoni27@gmail.com