- Rooms with a designated capacity (number of seats)
- Movies that are playing at a set time every day
- Tickets that are sold to customers
The API should be able to do the following
- Set up rooms
- Set up movie showtimes
- Sell some tickets
- Look at the list of movie rooms and what they're playing
- Look at the list of movies playing at the theater
- Buy tickets to a movie
- Virtual environment with install django and djangorestframework should be activated
- Run : python manage.py runserver
- API can be access on localhost:8000/rooms
API uses Interface from rest framework to test api and api can be interfaced using json format by adding ?format=json in urls
POST Request to http://localhost:8000/rooms as example :
{
"name" : "<room name, string>",
"seating_capacity" : "<seats, integer>"
}- As validation no two rooms can have same name
POST Request to http://localhost:8000/movies as example :
{
"title" : "<Movie name, string>",
"duration_in_minutes" : "<duration, integer>"
}- As validation no two movies can have same name
POST Request to http://localhost:8000/shows as example :
{
"room": "<room, id>",
"movie": "<movie, id>",
"startTime": "<datetime>",
"price": "<price, decimal/integer>"
} {
"room": 2,
"movie": 3,
"startTime": "2021-11-30T07:02:00Z",
"price": 90
}
- As validation no two shows clashes each other time
POST Request to http://localhost:8000/tickets as example :
{
"customer_name": "<string>",
"show": "<show id>",
"seats": "<integer>"
}
{
"customer_name": "Neeraj",
"show": 41,
"seats": 20,
}{
"id": 22,
"customer_name": "Neeraj",
"show": 41,
"seats": 20,
"amount": "1980.00"
}- As validation number of requested seats cannot be greater than available seats
GET Request to http://localhost:8000/movies as example response will be :
HTTP 200 OK
Allow: GET, POST, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept
{
"count": 4,
"next": null,
"previous": null,
"results": [
{
"id": 3,
"title": "Batman",
"duration_in_mintues": 60
},
{
"id": 4,
"title": "Document",
"duration_in_mintues": 30
},
{
"id": 5,
"title": "Longest",
"duration_in_mintues": 100
},
{
"id": 6,
"title": "liaght",
"duration_in_mintues": 150
}
]
}