Skip to content

Latest commit

 

History

History
124 lines (98 loc) · 2.13 KB

README.md

File metadata and controls

124 lines (98 loc) · 2.13 KB

Cinema-Rest

A simple ticket booking system for a movie theater with a 9x9 seating arrangement. Providing functionalities such as viewing available seats, purchasing a seat, returning a purchased seat, and viewing statistics of the room, all of which are exposed as RESTful APIs.

API Documentation

Endpoints
POST /purchase
Parameters
name type data type description
row required int from 1 to 9
column required int from 1 to 9
Request Body
{
    "row": int,
    "column": int
}
URL

http://localhost:28852/purchase

Responses
Code Description
200 OK
{
    "token": uuid
    "ticket": {
     "row": int
     "column": int
     "price": int
  }
}
POST /return
Request Body
{
    "token": "uuid"
}
URL

http://localhost:28852/return

Responses
Code Description
200 OK
400 Bad Request

When status 200:

{
  "returned_ticket": {
    "row": int,
    "column": int,
    "price": int
  }
}

When status 400:

{
    "error": "Wrong token!"
}
GET /stats?password=super_secret
URL

http://localhost:28852/stat

Params
Key Value
password super_secret
Responses
Code Description
200 OK
401 Unauthorized

When status 200:

{
  "current_income": int,
  "number_of_available_seats": int,
  "number_of_purchased_tickets": int
}

When status 401:

{
    "error": "The password is wrong!"
}