Casting Agency models a company that is responsible for creating movies and managing and assigning actors to those movies.
Link.
This is my Capstone (Casting Agency) project for the Udacity FSND.
Dependencies are listed in the requirements.txt
file.
Run pip3 install -r requirements.txt
to install them.
There are three Roles in this API
All tokens are in the setup.sh
file
- Fetches all the movies from the database
- Request arguments: None
- Returns: A list of movies contain key:value pairs of id, title and release_date
{
"success": true,
"movies": [
{
"id": 1,
"title": "Movie",
"release_date": "Sun, 12 July 2020 5:58:32 GMT"
},
{
"id": 2,
"title": "New movie",
"release_date": "Sun, 12 July 2020 5:58:32 GMT"
}
]
}
- Creates a movie from the request's body
- Request arguments: None
- Returns: the created movie contains key:value pairs of id, title and release_date
{
"title": "The Blacklist",
"release_date": "Sun, 12 July 2020 5:58:32 GMT"
}
{
"success": true,
"movie": {
"id": 1,
"title": "The Blacklist",
"release_date": "Sun, 12 July 2020 5:58:32 GMT"
}
}
- Updates a movie using the information provided by request's body
- Request arguments: Movie id
- Returns: the updated movie contains key:value pairs of id, title and release_date
{
"title": "The Blacklist 8",
"release_date": "Sun, 12 July 2020 5:58:32 GMT"
}
{
"success": true,
"movie": {
"id": 1,
"title": "The Blacklist 8",
"release_date": "Sun, 12 July 2020 5:58:32 GMT"
}
}
- Deletes a movie based the request argument
- Request arguments: Movie id
- Returns: the deleted movie id
{
"success": true,
"deleted": 1
}
- Fetches all the actors from the database
- Request arguments: None
- Returns: A list of actors contain key:value pairs of id, name, age and gender
{
"success": true,
"actors": [
{
"id": 1,
"name": "John",
"age": 35,
"gender": "Male"
},
{
"id": 2,
"name": "Ivy",
"age": 34,
"gender": "Women"
}
]
}
- Creates an actor from the request's body
- Request arguments: None
- Returns: the created actor contains key:value pairs of id, name, age and gender
{
"name": "John",
"age": 20,
"gender": "Women"
}
{
"success": true,
"actor": {
"id": 1,
"name": "John",
"age": 20,
"gender": "Women"
}
}
- Updates a actor using the information provided by request's body
- Request arguments: Actor id
- Returns: the updated actor contains key:value pairs of id, name, age and gender
{
"name": "John",
"age": 20,
"gender": "Women"
}
{
"success": true,
"actor": {
"id": 1,
"name": "John",
"age": 20,
"gender": "Women"
}
}
- Deletes an actor based the request argument
- Request arguments: Actor id
- Returns: the deleted actor id
{
"success": true,
"deleted": 1
}
200
: Request has been fulfilled201
: Entity has been created400
: Missing parameters or body401
: Unauthorized403
: Lack of specific permission404
: Resource not found409
: Conflict when creating a new entity422
: Wrong info provided
To run the tests, run python3 tests.py
.