Movies API is a simple REST API that enables to create resources: movies and comments about those movies, as well as retrieving information about movies and comments.
All examples use requests library.
Creates new Movie object based on POST request body parameter: "title".
requests.post('{hostname}/movies/', data={'title': 'return of the king'}
Returns a json with all Movies existing in the database.
requests.get('{hostname}/movies/')
Creates new Comment object based on POST request parameters: "movieid" and "comment". Creation of new comments is possible only for existing movies.
requests.post('{hostname}/comments/', data={"movieid": "1", "comment": "Great movie!"})
Returns a json with all Comments existing in the database.
requests.get('{hostname}/comments/')
Request url can be parametrized to filter comments by movie id.
request.get('{hostname}/comments/{movieid}/')
- Create and activate new python environment
$ python -m venv moviesapi
$ cd moviesapi
$ Scripts/activate.bat
- Clone repository.
$ git clone https://github.com/Westerby/MoviesAPI.git
- Install requirements.
$ pip install -r requirements.txt
- Run tests to check if everything is all right.
$ python manage.py test movies.tests
- Run server.
$ python manage.py runserver