Skip to content

Latest commit

 

History

History
133 lines (116 loc) · 2.68 KB

API.md

File metadata and controls

133 lines (116 loc) · 2.68 KB

API:

For all Requests, there's a "status" value (success\failure) , when request fails a "message" value includes the reason

Using HTTP Requests:

Registers a new user with the username and password passed if possible

localhost/Register/username=<USERNAME>&password=<PASSWORD>

Response:

{"key":"3X4MPL3K3Y" , "status": "success"}

Returns user's key

localhost/RecoverKey/username=<USERNAME>&password=<PASSWORD>

Response:

{"key":"3X4MPL3K3Y" , "status": "success"}

Orders a ticket for a movie at a location (represented by orderID) [Returns ticket id]

localhost/Order/key=<USERKEY>&movieID=<MOVIEID>&locationID=<LOCATIONID>
{"status":"success","message":"Ticket successfuly ordered"}

Returns tickets order history:

localhost/History/key=<USERKEY>

Response:

{
"status": "success",
"orders": [
{
"id": "1",
"movieID": "1",
"locationID": "1",
"canceled": "true",
"userKey": "WO1V3RK3YDCBA4321"
},
{
"id": "2",
"movieID": "2",
"locationID": "2",
"canceled": "true",
"userKey": "WO1V3RK3YDCBA4321"
}
]
}

Cancel a ticket

localhost/Cancel/key=<USERKEY>&orderID=<ORDERID>

Response:

{"status":"success","message":"Ticket successfuly canceled"}

Lists Movies information (empty for all movies):

localhost/Movies/
localhost/Movies/ID=<MOVIEID>
localhost/Movies/title=<MOVIENAME>

Response:

{"status":"success","movies":[{
                "id":"1",
                "title":"THOR",
                "producer":"MARVEL",
                "year":"2015",
                "info":"A MOVIE ABOUT SOMEONE WITH A HAMMER",
                "link":"thor.io"
        },{
                "id":"2",
                "title":"SPIDERMAN HOMECOMING",
                "producer":"MARVEL",
                "year":"2017",
                "info":"A MOVIE ABOUT SPIDERMAN JUST WITH A NEW ACTOR",
                "link":"SMHC.io"
        },{
                "id":"3",
                "title":"THE DARK KNIGHT",
                "producer":"DC",
                "year":"2014",
                "info":"A MOVIE ABOUT SOMEONE WITH MONEY AND TIME",
                "link":"BATMAN.io"
        }]}

Lists locations information (empty for all locations)

localhost/Locations/
localhost/Locations/ID=<LOCATIONID>
localhost/Locations/city=<LOCATIONCITY>
localhost/Locations/country=<LOCATIONCOUNTRY>

Response:

{
  "status": "success",
  "locations": [
    {
      "country": "Israel",
      "city": "Tel Aviv",
      "address": "HaMasger 2"
    },
    {
      "country": "Israel",
      "city": "Beer Sheva",
      "address": "Mesada 10"
    }
  ]
}