A simple Django REST API.
| field | type | description |
|---|---|---|
| id | integer | genre ID |
| name | string | genre name |
{
"id": 12,
"name": "Adventure"
}| field | type | description |
|---|---|---|
| id | id | movie ID |
| overview | string | movie overview |
| release_date | string | movie release date in ISO format |
| genres | array of genre objects | IDs of genres the movie is associated with |
| original_title | string | movie title in original language |
| original_language | string | original movie language code |
| title | string | movie title |
| popularity | number | movie popularity score |
| vote_count | integer | number of votes gathered by movie on TMDb |
| vote_average | number | movie vote average on TMDb |
{
"id": 238,
"overview": "Spanning the years 1945 to 1955, a chronicle of the fictional Italian-American Corleone crime family. When organized crime family patriarch, Vito Corleone barely survives an attempt on his life, his youngest son, Michael steps in to take care of the would-be killers, launching a campaign of bloody revenge.",
"release_date": "1972-03-14",
"genres": [
{ "id": 80, "name": "Crime" },
{ "id": 18, "name": "Drama" }
],
"original_title": "The Godfather",
"original_language": "en",
"title": "The Godfather",
"popularity": 26.961,
"vote_count": 10216,
"vote_average": 8.6
}| field | type | description |
|---|---|---|
| id | integer | comment ID |
| created_at | string | comment creation timestmap in ISO format |
| movie_id | integer | ID of the movie the comment is associated with |
| text | string | comment body |
{
"id": 1024,
"created_at": "2019-07-07T21:37:69.420Z",
"movie_id": 109445,
"text": "An abomination, worse than The Room"
}| field | type | description |
|---|---|---|
| error | string | error message |
{
"error": "Mandatory field 'title' is missing"
}| field | type | description |
|---|---|---|
| ?title | string | title fragment to be matched |
| ?order_by | string | comma-separated list of fields to order the results by |
200 and an array of matching movie objects or 422 and an error object.
| field | type | description |
|---|---|---|
| title | string | title fragment to be matched |
200/201 and the matching movie object or 404/422 and an error object.
| field | type | description |
|---|---|---|
| ?movie_id | integer | ID of the movie the fetched comments shall be associated with |
200 and an array of matching comment objects or 422 and an error object.
| field | type | description |
|---|---|---|
| movie_id | integer | ID of the movie the comment shall be associated with |
| text | string | comment body |
201 and the created comment object or 422 and an error object.
| field | type | description |
|---|---|---|
| start_date | string | start date of the ranking period in ISO format |
| end_date | string | end date of the ranking period in ISO format |
| ?max_rank | integer | the maximum rank returned |
200 and an array of matching comment objects or 422 and an error object.
This is the easiest way to run MovieProxy.
Create a Heroku app, connect this repository to it and, in the Settings tab, add the following config vars to it:
DISABLE_COLLECTSTATIC– set this to1to disable a Heroku feature that would be problematic in this caseALLOWED_HOSTS– a comma-separated list of hostnames on which your app shall be available (e.g.movieproxy.herokuapp.com)SECRET_KEY– a Django secret keyTMDB_API_KEY– a TMDb API key for fetching movie details
Optionally you can also add var DEBUG and set it to anything to anything to enable Django debug mode.
Then install the Heroku Postgres addon in the Resources tab. The app will automatically use this database.
Now deploy from the Deploy tab and wait for migrations to finish. After that, the app should be online and ready for use.
Why these packages?
Django– it's Djangorequests– for communication with the TMDb APIpsycopg2– for Postgres support (SQLite may be used in development but Postgres is production–grade)dj-database-url– for Heroku Postgres add-on support (extremely simple to set up this way)
The contents of this project are licensed under the Mozilla Public License 2.0.