Git Product home page Git Product logo

movie-db-api's Introduction

Movie API

Short description

Api fetches movie data from www.omdbapi.com and saves it to database.

Requirements

Api was developed using Django and Django REST frameworks. Additionally requests library was used to interact with www.omdbapi.com api. Database on production server is Postgresql (instead of sqlite which was used only for development) so psycopg2 database adapter was added to requirements file.

Api tested with Python 3.7

How to run project locally

Clone repository and got to project's root directory afterwards follow steps:

  1. Activate python virtual environment
    source /path/to/local/env

  2. Install requirements
    pip install -r requirements.txt

  3. Run server
    python manage.py runserver

  4. Api can be tested by sending requests to address http://127.0.0.1:8000/resource_name

Endpoints

GET /movies/

Download all movies.

POST /movies/

Download movie data from external api and save it in database.

Required Headers:
Content-Type: application/json

Required json body fields:
title

DELETE /movies//

Delete movie

movie-id from URL is used to determine which movie should be deleted

UPDATE /movies/<movie_id>/

Update movie

Required Headers:
Content-Type: application/json

Json body should contain field names and values which supposed to be updated. For instance:

{
    "title": "Terminator",
    "year": "1993",
    "rated": "",
    "released": "2019-01-02",
    "runtime": 39,
    "genre": "Short, Action, Sci-Fi",
    "director": "Ben Hernandez",
}

movie-id from URL is used to determine which movie should be updated

POST /comments

Create comment attached to movie

Required Headers:
Content-Type: application/json

Json body requires body and movie_id fields.

{
    "body": "Good movie",
    "movie_id": 1
}

GET /comments

Show all created comments or only comments attached to specific movie

To get comments attached to specific movie add query params so that url will look like comments/?movie_id=1

GET /top

Show movie ranking based on number of comments

Required query params date_from, date_to

Demo

Api deployed to https://movie-db-api.cleverapps.io

movie-db-api's People

Contributors

apqlzm avatar dependabot[bot] avatar

Stargazers

TALAT avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.