Project API
For purposes of this API description, all URLs are relative to the base url of http://localhost:8080/thalia
Also, all data is in JSON format. A GET request will return JSON. A PUT or POST will submit a JSON document.
To keep things simple, no authentication is required to access any resource.
All use cases marked with [*] are not required as part of the final delivery for this project.
The following abbreviations are used throughout this document:
- wid: show id
- sid: section id
- cid: seat (chair) id
- did: id of request for donated tickets
- oid: order id
- tid: ticket id
- mrid: manager report id
Shows
^Top^ ^Shows^
Create show: POST /shows
Creates a show instance and returns (in the body of the response) the ID of the show instance.
NOTE: It would probably be better to have have an API where the show description is independent
of the schedule of various instances of that show.
'Location' header with link to /shows/{wid} where {wid} is the newly assigned ID for the
show instance.
HTTP response code: 201 (Created) if everything is ok. 400 (Bad Request) if any of the required data
is missing or is invalid.
Resource URL
/shows
Parameters
show_info: Information about the show
- name (required): the name of the show
- web (optional): the URL for the show's website
- date (required): date (YYYY-MM-DD) for this show instance
- time (required): time (HH:MM) for this show instance
seating_info: Sections and pricing
-
sid (required): the ID of the section where seating is available for
this show instance
-
price: the price of a ticket in this section
Example Request
POST http://localhost:8080/thalia/shows
Here is data being POST-ed
{
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"seating_info": [
{
"sid": "123",
"price": 600
},
{
"sid": "124",
"price": 75
},
{
"sid": "125",
"price": 60
}
]
}
Example Response
{
"wid": "308"
}
^Top^ ^Shows^
Update show: PUT /shows/{wid}
Updates the show instance identified by {wid}. The payload of the request
replaces the existing resource.
HTTP response code: 200 (OK). The body of the response will be empty.
If the show instance identified by {wid} doesn't exist, then the HTTP response
code will be 404 (Not Found).
Resource URL
/shows/{wid}
Parameters
show_info: Information about the show
- name (required): the name of the show
- web (optional): the URL for the show's website
- date (required): date (YYYY-MM-DD) for this show instance
- time (required): time (HH:MM) for this show instance
seating_info: Sections and pricing
-
sid (required): the ID of the section where seating is available for
this show instance
-
price: the price of a ticket in this section
Example Request
PUT http://localhost:8080/thalia/shows/308
Here is data being PUT
{
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"seating_info": [{
"sid": "123",
"price": 60
},
{
"sid": "124",
"price": 75
},
{
"sid": "125",
"price": 60
}
]
}
Example Response
The body of the response is empty.
^Top^ ^Shows^
View show: GET /shows/{wid}
Returns detailed information about the show instance identified by {wid}.
HTTP response code: 200 (OK) or 404 (Not found) if the show instance
identified by {wid} doesn't exist.
Resource URL
/shows/{wid}
Parameters
None.
Example Request
GET http://localhost:8080/thalia/shows/308
Example Response
{
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"seating_info": [{
"sid": "123",
"price": 60
},
{
"sid": "124",
"price": 75
},
{
"sid": "125",
"price": 60
}
]
}
^Top^ ^Shows^
View all shows: GET /shows
Returns an array of show instances.
HTTP response code: 200 (OK).
Resource URL
/shows
Parameters
None.
Example Request
GET http://localhost:8080/thalia/shows
Example Response
[{
"wid": "307",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-04",
"time": "19:00"
}
},
{
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
}
},
{
"wid": "309",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "19:00"
}
}
]
^Top^ ^Shows^
View show sections: GET /shows/{wid}/sections
Returns information about all sections in the theatre.
HTTP response code: 200 (OK).
Resource URL
/sections
Parameters
None.
Example Request
GET http://localhost:8080/thalia/shows/308/sections
Example Response
[{
"sid": "123",
"section_name": "Front right",
"price": 60
},
{
"sid": "124",
"section_name": "Front center",
"price": 75
},
{
"sid": "125",
"section_name": "Front left",
"price": 60
}
]
^Top^ ^Shows^
View show specific section: GET /shows/{wid}/sections/{sid}
Returns specific seat availability in section {sid} for the show instance
identified by {wid}.
HTTP response code: 200 (OK).
Resource URL
/shows/{wid}/sections/{sid}
Parameters
None.
Example Request
GET http://localhost:8080/thalia/shows/308/sections/123
Example Response
{
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"sid": "123",
"section_name": "Front right",
"price": 60,
"seating": [{
"row": "1",
"seats": [{
"cid": "201",
"seat": "1",
"status": "available"
},
{
"cid": "202",
"seat": "2",
"status": "available"
},
{
"cid": "203",
"seat": "3",
"status": "available"
},
{
"cid": "204",
"seat": "4",
"status": "sold"
}
]
},
{
"row": "2",
"seats": [{
"cid": "213",
"seat": "1",
"status": "available"
},
{
"cid": "214",
"seat": "2",
"status": "available"
},
{
"cid": "215",
"seat": "3",
"status": "available"
},
{
"cid": "216",
"seat": "4",
"status": "available"
}
]
},
{
"row": "3",
"seats": [{
"cid": "225",
"seat": "1",
"status": "available"
},
{
"cid": "226",
"seat": "2",
"status": "available"
},
{
"cid": "227",
"seat": "3",
"status": "available"
},
{
"cid": "228",
"seat": "4",
"status": "available"
}
]
},
{
"row": "4",
"seats": [{
"cid": "238",
"seat": "1",
"status": "available"
},
{
"cid": "239",
"seat": "2",
"status": "available"
},
{
"cid": "239",
"seat": "3",
"status": "available"
},
{
"cid": "240",
"seat": "4",
"status": "available"
}
]
}
]
}
^Top^ ^Shows^
Subscribe to receive donated tickets: POST /shows/{wid}/donations
Request tickets for the show identified by {wid}.
'Location' header with link to /shows/{wid}/donations/{did} where {did} is the ID
assigned to the request. The body of the response will also contain {did}.
HTTP response code: 201 (Created) if everything is ok. 400 (Bad Request) if any of the required data
is missing or is invalid.
Resource URL
/shows/{wid}/donations
Parameters
- count (required): the number of donated seats required
patron_info: Information about the patron and payment.
- name: name of the patron placing the order
- phone: patron's phone number in the format ddd-ddd-dddd
- email: patron's email address
- billing_address: the address associated with the CC used to pay for tickets
- cc_number: CC number used to pay for the order, either 15 or 16 digits
- cc_expiration_date: CC expiration date in the MM/YY format
NOTE: a credit card is technically not required since the patron doesn't pay for donated
tickets, however the owner of the theatre may want to have the info on file should she decide
to charge patrons that have been assigned donated tickets but didn't use them.
Example Request
POST http://localhost:8080/thalia/shows/308/donations
Here is data being POST-ed
{
"wid": "308",
"count": 2,
"patron_info": {
"name": "John Smith",
"phone": "123-457-6890",
"email": "john.smith@example.com",
"billing_address": "123 Main ST, Anytown, CA 90999",
"cc_number": "1234567890985432",
"cc_expiration_date": "4/22"
}
}
Example Response
{
"did": "759"
}
^Top^ ^Shows^
View status of request for donated tickets: GET /shows/{wid}/donations/{did}
Returns the status of the request, "pending" or "assigned" together with an array of ticket IDs,
empty if the status is "pending", non-empty otherwise.
HTTP response code: 200 (OK). 400 (Not found) if {wid} and/or {did} are invalid.
Resource URL
/shows/{wid}/donations/{did}
Parameters
None.
Example Request
GET http://localhost:8080/thalia/shows/308/donations/759
Example Response
{
"did": "759",
"wid": "308",
"count": 2,
"status": "pending",
"tickets": [],
"patron_info": {
"name": "John Smith",
"phone": "123-457-6890",
"email": "john.smith@example.com",
"billing_address": "123 Main ST, Anytown, CA 90999",
"cc_number": "1234567890985432",
"cc_expiration_date": "4/22"
}
}
Another Example Response
{
"did": "759",
"wid": "308",
"count": 2,
"status": "assigned",
"tickets": ["747", "901"],
"patron_info": {
"name": "John Smith",
"phone": "123-457-6890",
"email": "john.smith@example.com",
"billing_address": "123 Main ST, Anytown, CA 90999",
"cc_number": "1234567890985432",
"cc_expiration_date": "4/22"
}
}
^Top^ ^Shows^
Seating
^Top^ ^Seating^
Request seats auto: GET /seating?show={wid}§ion={sid}&count=[0-9]+[&starting_seat_id={cid}]
Returns an array of "count" contiguous seats that are available in section {sid} for the
show identified by {wid}.
HTTP response code: 200 (OK). If "count" contiguous seats are not available in the section
identified by {sid}, then return an error message.
404 (Not found) if {wid} and/or {sid} are invalid.
Resource URL
/seating
Parameters
show (required): the id of the show for which seats are being requested
section (required): the id of the section in which sections are being requested
count (required): the number of seats being requested. Must be a positive integer.
starting_seat_id (optional): the id of the seat where to start looking for
contiguous seats in the section identified by {sid} and the show {wid}.
If this parameter is not used than then application may always return the same
array of seats for the request, assuming no other patron has got some of those
seats in their order.
Example Request
GET http://localhost:8080/thalia/seating?show=308§ion=123&count=3
Example Response
{
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"sid": "123",
"section_name": "Front right",
"starting_seat_id": "201",
"status": "ok",
"total_amount": 180,
"seating": [{
"row": "1",
"seats": [{
"cid": "201",
"seat": "1",
"status": "available"
},
{
"cid": "202",
"seat": "2",
"status": "available"
},
{
"cid": "203",
"seat": "3",
"status": "available"
}
]
}]
}
Another Example Request
GET http://localhost:8080/thalia/seating?show=308§ion=123&count=5
Example Response
{
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"sid": "123",
"section_name": "Front right",
"starting_seat_id": "201",
"status": "Error: 5 contiguous seats not available",
"seating": []
}
Example Request using starting_seat_id
GET http://localhost:8080/thalia/seating?show=308§ion=123&count=3&starting_seat_id=202
Example Response
{
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"sid": "123",
"section_name": "Front right",
"starting_seat_id": "202",
"status": "ok",
"total_amount": 180,
"seating": [{
"row": "1",
"seats": [{
"cid": "202",
"seat": "2",
"status": "available"
},
{
"cid": "203",
"seat": "3",
"status": "available"
},
{
"cid": "204",
"seat": "4",
"status": "available"
}
]
}]
}
^Top^ ^Seating^
View all sections: GET /seating
Returns information about all sections in the theatre.
HTTP response code: 200 (OK).
Resource URL
/seating
Parameters
None.
Example Request
GET http://localhost:8080/thalia/seating
Example Response
[{
"sid": "123",
"section_name": "Front right"
},
{
"sid": "124",
"section_name": "Front center"
},
{
"sid": "125",
"section_name": "Front left"
},
{
"sid": "126",
"section_name": "Main right"
},
{
"sid": "127",
"section_name": "Main center"
},
{
"sid": "128",
"section_name": "Main left"
}
]
^Top^ ^Seating^
View specific section: GET /seating/{sid}
Returns detailed information about the section identified by {sid}.
HTTP response code: 200 (OK) or 404 (Not found) if the section
identified by {sid} doesn't exist.
Resource URL
/seating/{sid}
Parameters
None.
Example Request
GET http://localhost:8080/thalia/seating/123
Example Response
{
"sid": "123",
"section_name": "Front right",
"seating": [{
"row": "1",
"seats": [
"1",
"2",
"3",
"4"
]
},
{
"row": "2",
"seats": [
"1",
"2",
"3",
"4"
]
},
{
"row": "3",
"seats": [
"1",
"2",
"3",
"4"
]
},
{
"row": "4",
"seats": [
"1",
"2",
"3",
"4"
]
}
]
}
^Top^ ^Seating^
Orders
^Top^ ^Orders^
Create order: POST /orders
Creates an order and returns (in the body of the response) the ID of the order
and an array of tickets in the order.
'Location' header with link to /orders/{oid} where {oid} is the newly assigned ID for the
order.
HTTP response code: 201 (Created) if everything is ok. 400 (Bad Request) if any of the required data
is missing or is invalid, or if one or more of the seats in the order request are no longer
available.
Resource URL
/orders
Parameters
- {wid} (required): the show instance for which the order is placed
- section (required): {sid}, the section in which the seats are located
- seats (required): an array of {cid}, the specific seats that are requested
patron_info: Information about the patron and payment.
- name: name of the patron placing the order
- phone: patron's phone number in the format ddd-ddd-dddd
- email: patron's email address
- billing_address: the address associated with the CC used to pay for tickets
- cc_number: CC number used to pay for the order, either 15 or 16 digits
- cc_expiration_date: CC expiration date in the MM/YY format
Example Request
POST http://localhost:8080/thalia/orders
Here is data being POST-ed
{
"wid": "308",
"sid": "123",
"seats": [{
"cid": "201",
"seat": "1"
},
{
"cid": "202",
"seat": "2"
},
{
"cid": "203",
"seat": "3"
}
],
"patron_info": {
"name": "John Doe",
"phone": "123-456-7890",
"email": "john.doe@example.com",
"billing_address": "123 Main ST, Anytown, IL 45678",
"cc_number": "1234567890987654",
"cc_expiration_date": "12/21"
}
}
Example Response
{
"oid": "411",
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"date_ordered": "2017-10-28 18:24",
"order_amount": 180,
"tickets": ["729", "730", "731"]
}
^Top^ ^Orders^
View all orders: GET /orders
Returns an array of all orders placed so far.
HTTP response code: 200 (OK).
Resource URL
/orders
Parameters
None.
Example Request
GET http://localhost:8080/thalia/orders
Example Response
[{
"oid": "411",
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"date_ordered": "2017-10-28 18:24",
"order_amount": 180,
"number_of_tickets": 3,
"patron_info": {
"name": "John Doe",
"phone": "123-456-7890",
"email": "john.doe@example.com",
"billing_address": "123 Main ST, Anytown, IL 45678",
"cc_number": "xxxxxxxxxxxx7654",
"cc_expiration_date": "12/21"
}
},
{
"oid": "412",
"wid": "307",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-04",
"time": "19:00"
},
"date_ordered": "2017-10-26 11:59",
"order_amount": 120,
"number_of_tickets": 2,
"patron_info": {
"name": "Jane Doe",
"phone": "678-901-2345",
"email": "jane.doe@example.com",
"billing_address": "123 Main ST, Sometown, CA 90123",
"cc_number": "xxxxxxxxxxxx4567",
"cc_expiration_date": "04/22"
}
},
{
"oid": "413",
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"date_ordered": "2017-10-27 13:01",
"order_amount": 75,
"number_of_tickets": 1,
"patron_info": {
"name": "King maximilian",
"phone": "312-567-3000",
"email": "king.maximilian@example.com",
"billing_address": "10 West 32nd ST, Chicago IL 60616",
"cc_number": "xxxxxxxxxxx0012",
"cc_expiration_date": "11/19"
}
}
]
^Top^ ^Orders^
View orders by date: GET /orders?start_date=YYYYMMDD&end_date=YYYYMMDD
Returns an array of all orders placed between the two dates.
HTTP response code: 200 (OK).
Resource URL
/orders
Parameters
- start_date: any orders older than this date won't be included in the data set
- end_date: any orders newer than this date won't be included in the data set
Example Request
GET http://localhost:8080/thalia/orders?start_date=20171026&end_date=20171027
Example Response
[{
"oid": "412",
"wid": "307",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-04",
"time": "19:00"
},
"date_ordered": "2017-10-26 11:59",
"order_amount": 120,
"number_of_tickets": 2,
"patron_info": {
"name": "Jane Doe",
"phone": "678-901-2345",
"email": "jane.doe@example.com",
"billing_address": "123 Main ST, Sometown, CA 90123",
"cc_number": "xxxxxxxxxxxx4567",
"cc_expiration_date": "04/22"
}
},
{
"oid": "413",
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"date_ordered": "2017-10-27 13:01",
"order_amount": 75,
"number_of_tickets": 1,
"patron_info": {
"name": "King maximilian",
"phone": "312-567-3000",
"email": "king.maximilian@example.com",
"billing_address": "10 West 32nd ST, Chicago IL 60616",
"cc_number": "xxxxxxxxxxx0012",
"cc_expiration_date": "11/19"
}
}
]
^Top^ ^Orders^
View order: GET /orders/{oid}
Returns detailed innformation about the order identified by {oid}.
HTTP response code: 200 (OK). 404 (Not Found) if {oid} doesn't exist.
Resource URL
/orders/{oid}
Parameters
None.
Example Request
GET http://localhost:8080/thalia/orders/411
Example Response
{
"oid": "411",
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"date_ordered": "2017-10-28 18:24",
"order_amount": 180,
"number_of_tickets": 3,
"patron_info": {
"name": "John Doe",
"phone": "123-456-7890",
"email": "john.doe@example.com",
"billing_address": "123 Main ST, Anytown, IL 45678",
"cc_number": "xxxxxxxxxxxx7654",
"cc_expiration_date": "12/21"
},
"tickets": [{
"tid": "729",
"status": "open"
}, {
"tid": "730",
"status": "open"
}, {
"tid": "731",
"status": "open"
}]
}
^Top^ ^Orders^
Tickets
^Top^ ^Tickets^
View ticket: GET /tickets/{tid}
Returns detailed innformation about the ticket identified by {tid}.
HTTP response code: 200 (OK). 404 (Not Found) if {tid} doesn't exist.
Resource URL
/tickets/{tid}
Parameters
None.
Example Request
GET http://localhost:8080/thalia/tickets/729
Example Response
{
"tid": "729",
"price": 60,
"status": "open",
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"patron_info": {
"name": "John Doe",
"phone": "123-456-7890",
"email": "john.doe@example.com",
"billing_address": "123 Main ST, Anytown, IL 45678",
"cc_number": "xxxxxxxxxxxx7654",
"cc_expiration_date": "12/21"
},
"sid": "123",
"section_name": "Front right",
"seating": [{
"row": "1",
"seats": [{
"cid": "201",
"seat": "1"
}]
}]
}
^Top^ ^Tickets^
Scan ticket: POST /tickets/{tid}
Changes the status of a ticket from "open" to "used".
'Location' header with link to /tickets/{tid} where {tid} is the ticket ID.
HTTP response code: 200 (OK) if everything is ok. 400 (Bad Request) if any of the required data
is missing or is invalid.
Resource URL
/tickets
Parameters
- {tid} (required): the ID of the ticket being scanned
Example Request
POST http://localhost:8080/thalia/tickets/730
Here is data being POST-ed
{
"tid": "730",
"status": "used"
}
Example Response
{
"tid": "730",
"status": "used"
}
^Top^ ^Tickets^
Donate tickets: POST /tickets/donations
Donates one or more tickets. The patron who initially created the order that includes
donated tickets won't be able to use the donated tickets any more.
'Location' header with link to /orders/{oid} where {oid} is the order from which one
or more tickets were donated.
HTTP response code: 201 (Created) if everything is ok. 400 (Bad Request) if any of the required data
is missing or is invalid. The body of the response is empty.
Resource URL
/tickets/donations
Parameters
- tickets (required): array of ticket IDs to be donated.
Example Request
POST http://localhost:8080/thalia/tickets/donations
Here is data being POST-ed
{
"tickets": ["731"]
}
^Top^ ^Tickets^
Reports
^Top^ ^Reports^
Get list of available reports: GET /reports
Returns an array of report IDs with their corresponding names.
HTTP response code: 200 (OK).
Resource URL
/reports
Parameters
None.
Example Request
GET http://localhost:8080/thalia/reports
Example Response
[{
"mrid": "801",
"name": "Theatre occupancy"
}, {
"mrid": "802",
"name": "Revenue from ticket sales"
},
{
"mrid": "803",
"name": "Donated tickets report"
}
]
^Top^ ^Reports^
Get report: GET /reports/{mrid}[ ?show={wid} | ?start_date=YYYYMMDD&end_date=YYYYMMDD ]
Returns the report identified by {mrid}. If no show ID ({wid}) is provided and no dates,
then run the report for all shows and all dates. If a show ID is provided,
then run the report just for that show. Alternately, instead of a show ID, a date range
can be provided; in this case run the report for all shows that fall between
the start_date and the end_date.
HTTP response code: 200 (OK) or 404 (Not Found) if {mrid} [or {wid} or both] is invalid.
Resource URL
/report/{mrid}
Parameters
{mrid} (required): the ID of the report to be generated.
{wid} (optional): the ID of the show for which the report is to be generated.
start_date (optional): the start date for the date range of the report.
end_date (optional): the end date for the date range of the report.
Example Request
GET http://localhost:8080/thalia/reports/801
Example Response
{
"mrid": "801",
"name": "Occupancy report",
"start_date": "",
"end_date": "",
"total_shows": 3,
"total_seats": 255,
"sold_seats": 179,
"overall_occupancy": "70.1%",
"shows": [{
"wid": "307",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-04",
"time": "19:00"
},
"seats_available": 102,
"seats_sold": 91,
"occupancy": "89.2%"
},
{
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"seats_available": 51,
"seats_sold": 5,
"occupancy": "9.8%"
},
{
"wid": "309",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "19:00"
},
"seats_available": 102,
"seats_sold": 83,
"occupancy": "81.3%"
}
]
}
Another Example Request
GET http://localhost:8080/thalia/reports/802?show=308
Example Response
{
"mrid": "802",
"name": "Revenue from ticket sales",
"start_date": "",
"end_date": "",
"total_shows": 1,
"total_seats": 51,
"sold_seats": 5,
"overall_revenue": 360,
"shows": [{
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"sections": [{
"sid": "123",
"section_name": "Front right",
"section_price": 60,
"seats_available": 16,
"seats_sold": 1,
"section_revenue": 60
},
{
"sid": "124",
"section_name": "Front center",
"section_price": 75,
"seats_available": 19,
"seats_sold": 4,
"section_revenue": 300
},
{
"sid": "125",
"section_name": "Front left",
"section_price": 60,
"seats_available": 16,
"seats_sold": 0,
"section_revenue": 0
}
]
}]
}
One More Example Request
GET http://localhost:8080/thalia/reports/803?start_date=20171201&end_date=20171231
Example Response
{
"mrid": "803",
"name": "Donated tickets report",
"start_date": "20171201",
"end_date": "20171231",
"total_shows": 3,
"total_seats": 255,
"sold_seats": 179,
"donated_tickets": 5,
"donated_and_used_tickets": 4,
"donated_and_used_value": 220,
"shows": [{
"wid": "307",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-04",
"time": "19:00"
},
"seats_available": 102,
"seats_sold": 91,
"donated_tickets": 3,
"donated_and_used_tickets": 2,
"donated_and_used_value": 100
},
{
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"seats_available": 51,
"seats_sold": 5,
"donated_tickets": 2,
"donated_and_used_tickets": 2,
"donated_and_used_value": 120
},
{
"wid": "309",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "19:00"
},
"seats_available": 102,
"seats_sold": 83,
"donated_tickets": 0,
"donated_and_used_tickets": 0,
"donated_and_used_value": 0
}
]
}
^Top^ ^Reports^
Search
- Search ( GET /search?topic=topicword&key=keyword )
^Top^ ^Search^
Search: GET /search?topic=topicword&key=keyword
Returns all entities within the "topic" ("topicword" can be one of "show", "order")
that match the "key" ("keyword" is a single word string, e.g. "bob", "King", etc.)
HTTP response code: 200 (OK), or 404 if "topicword" has a value that's not allowed.
Resource URL
/search?topic=topicword&key=keyword
Parameters
topic (required): the topic for search. The value for topic can be
any of "show", "order".
key (required): the search key. Anything that matches the keyword (the value of key)
will be included in the result set. The search is case insensitive. If keyword is empty, then match
everything.
Example Request
GET http://localhost:8080/thalia/search?topic=show&key=king
Example Response
{
"shows": [{
"wid": "307",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-04",
"time": "19:00"
}
},
{
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
}
},
{
"wid": "309",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "19:00"
}
}
]
}
Here is an example with the "order" topic; in this example the match is on the
order ID.
Example Request
GET http://localhost:8080/lf2u/search?topic=order&key=411
Example Response
{
"orders": [{
"oid": "411",
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"date_ordered": "2017-10-28 18:24",
"order_amount": 180,
"number_of_tickets": 3,
"patron_info": {
"name": "John Doe",
"phone": "123-456-7890",
"email": "john.doe@example.com",
"billing_address": "123 Main ST, Anytown, IL 45678",
"cc_number": "xxxxxxxxxxxx7654",
"cc_expiration_date": "12/21"
}
}]
}
One more example with the "order" topic; in this case the match is on the name
of the patron.
Example Request
GET http://localhost:8080/lf2u/search?topic=order&key=doe
Example Response
{
"orders": [{
"oid": "411",
"wid": "308",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-05",
"time": "13:00"
},
"date_ordered": "2017-10-28 18:24",
"order_amount": 180,
"number_of_tickets": 3,
"patron_info": {
"name": "John Doe",
"phone": "123-456-7890",
"email": "john.doe@example.com",
"billing_address": "123 Main ST, Anytown, IL 45678",
"cc_number": "xxxxxxxxxxxx7654",
"cc_expiration_date": "12/21"
}
},
{
"oid": "412",
"wid": "307",
"show_info": {
"name": "King Lear",
"web": "http://www.example.com/shows/king-lear",
"date": "2017-12-04",
"time": "19:00"
},
"date_ordered": "2017-10-26 11:59",
"order_amount": 120,
"number_of_tickets": 2,
"patron_info": {
"name": "Jane Doe",
"phone": "678-901-2345",
"email": "jane.doe@example.com",
"billing_address": "123 Main ST, Sometown, CA 90123",
"cc_number": "xxxxxxxxxxxx4567",
"cc_expiration_date": "04/22"
}
}
]
}
^Top^ ^Search^
$Id: project-api.html,v 1.14 2017/11/09 21:36:08 virgil Exp $
|