- The public app is hosted at Digital Ocean, HTTPS enabled, with Docker, Docker-Compose, Gunicorn and NGINX. Click here to try it.
Always use
https, when using the public app. Post requests might not work, when used withhttp. - For POST /comments and GET /comments, imdbID should be passed, instead of application database primary key id Because imdbID's are guaranteed to be unique
- Tests are at movieapi/tests.py, and test data is available at movieapi/fixtures/test_data.json.
manage.py loaddatacan be used
- Django Rest Framework for easy API Creation
- requests library to make a call to external movie API
- Make sure
dockeranddocker-composeare installed, anddocker serviceis running on your system - Clone this repo
- Run
docker-compose up, under the cloned repo's directory - Go to
localhost:8000/moviesfrom your favourite browser and play around with API - Database will be persisted in
postgres_datafolder, in case you restart docker services - When you are done playing around, run
docker-compose down
- Request body should contain only movie title, and named as
movie_title. for example->movie_title=braveheart - Its presence is validated with the external API
- Duplicate movie saving is not allowed, by checking records with the same imdb ID in the database
- All movie data from external API are saved to application database, except Year, Ratings and Response, because there is another data related
- Newly saved movie data is returned
- If no parameter is given, it will return all movies in the application database
order_by=title, ororder_by=ratingcan be used to order by movie title, or imdb ratingdesc=trueparameter can be given to reverse the order- if
descparameter is given without theorder_byparameter, then will return all movies without ordering
- Request body should contain imdbID of movie already present in database, and comment text body
for example ->
movie_id=tt0112573andcomment=simple comment - Comment is saved to application database and returned in request response
- Fetches list of all comments present in application database
- By passing associated movie imdbID, allows filtering comments. for example ->
movie_id=tt0112573
- Returns top movies already present in the database ranking based on a number of comments added to the movie in the specified date range. The response includes the ID of the movie(in this case, the application database id), position in rank and total number of comments (in the specified date range)
- Date range is specified like this example -->
start_date=2019-5-21andend_date=2019-5-26. Month can be 0 padded(ie. 05) Date seperator must be hyphen(-)
Thank you!
Alican