The architecture of the service will be as follows:
Web Front End - The web front end will implement an external web service API for the application and will support APIs for the following operations:
- Get a list of all events
- Create a new event
- Get details about a specific event
- Purchase tickets for an event
- Create a user
- See a user's information, including details of all events for which the user has purchased tickets
- Transfer tickets from one user to another
Event Service - The event service will manage the list of events and the number of tickets sold and available for each. When a ticket is purchased it is the responsibility of the Event Service to notify the User Service of the user's purchase. The API will support the following operations:
- Create a new event
- Get a list of all events
- Get details about a specific event
- Purchase tickets for an event, updating the user's ticket list
User Service - The user service will manage the user account information, including the events for which a user has purchased tickets. The API will support the following operations:
- Create a new user
- Get user details
- Add a new ticket for a user
- Transfer tickets from one user to another
GET /events
Responses:
Code | Description |
200 | Event Details[ { "eventid": 0, "eventname": "string", "userid": 0, "avail": 0, "purchased": 0 } ] |
400 | No events found |
POST /events/create
Body:
{ "userid": 0, "eventname": "string", "numtickets": 0 }
Responses:
Code | Description |
200 | Event created
{ "eventid": 0 } |
400 | Event unsuccessfully created |
GET /events/{eventid}
Responses:
Code | Description |
200 | Event Details{ "eventid": 0, "eventname": "string", "userid": 0, "avail": 0, "purchased": 0 } |
400 | Event not found |
POST /events/{eventid}/purchase/{userid}
Body:{ "tickets": 0 }
Responses:
Code | Description |
200 | Tickets purchased |
400 | Tickets could not be purchased |
POST /users/create
Body:
{ "username": "string" }
Responses:
Code | Description |
200 | User created{ "userid": 0 } |
400 | User could not be created |
GET /users/{userid}
Responses:
Code | Description |
200 | User Details{ "userid": 0, "username": "string", "tickets": [ { "eventid": 0, "eventname": "string", "userid": 0, "avail": 0, "purchased": 0 } ] } |
400 | User not found |
POST /users/{userid}/tickets/transfer
Body:
{ "eventid": 0, "tickets": 0, "targetuser": 0 }
Responses:
Code | Description |
200 | Event tickets transferred |
400 | Tickets could not be transferred |
POST /create
Body:
{ "userid": 0, "eventname": "string", "numtickets": 0 }
Responses:
Code | Description |
200 | Event created
{ "eventid": 0 } |
400 | Event unsuccessfully created |
GET /list
Responses:
Code | Description |
200 | List of events [ { "eventid": 0, "eventname": "string", "userid": 0, "avail": 0, "purchased": 0 } ] |
GET /{eventid}
Responses:
Code | Description |
200 | Event details{ "eventid": 0, "eventname": "string", "userid": 0, "avail": 0, "purchased": 0 } |
400 | Event not found |
POST /purchase/{eventid}
Body:
{ "userid": 0, "eventid": 0, "tickets": 0 }
Responses:
Code | Description |
200 | Event tickets purchased |
400 | Tickets could not be purchased |
POST /create
Body:
{ "username": "string" }
Responses:
Code | Description |
200 | User created{ "userid": 0 } |
400 | User unsuccessfully created |
GET /{userid}
Responses:
Code | Description |
200 | User details{ "userid": 0, "username": "string", "tickets": [ { "eventid": 0 } ] } |
400 | User not found |
POST /{userid}/tickets/add
Body:
{ "eventid": 0, "tickets": 0 }
Responses:
Code | Description |
200 | Event tickets added |
400 | Tickets could not be added |
POST /{userid}/tickets/transfer
Body:
{ "eventid": 0, "tickets": 0, "targetuser": 0 }
Responses:
Code | Description |
200 | Event tickets transfered |
400 | Tickets could not be transfered |