rest api for flight-ticket
- AIRPORT
- get all airports
GET /airports
- get airport by name
GET /airports/name/{name}
- get airport by id
GET /airports/{id}
- add airport
POST /airports
Airport JSON body: { "name": "airportName" }
- delete airport
DELETE /airports/{id}
- update airport
PUT /airports
Airport JSON body: { "id": "airportId", "name": "airportName" }
- COMPANY
- get all companies
GET /companies
- get company by name
GET /companies/name/{name}
- get company by id
GET /companies/{id}
- add company
POST /companies
Company JSON body: { "name": "companyName" }
- delete company
DELETE /companies/{id}
- update company
PUT /companies
Company JSON body: { "id": "companyId", "name": "companyName", "flights": "companyFlights" }
- ROUTE
- get all routes
GET /routes
- get route by id
GET /routes/{id}
- get route by departure
GET /routes/departure/{name}
- get route by destination
GET /routes/destination/{name}
- add route
POST /routes
Route JSON body: { "departure": { "name": "departureName" }, "destination": { "name": "destinationName" } }
- delete route
DELETE /routes/{id}
- update route
PUT /routes
Route JSON body: { "id": "routeId", "departure": { "id": "departureId", "name": "departureName" }, "destination": { "id": "destinationId", "name": "destinationName" } }
- FLIGHT
- get all flights
GET /flights
- get flights by company name
GET /flights/company/{name}
- get flight by id
GET /flights/{id}
- add flight
POST /flights
Flight JSON body: { "route": { "id": "routeId" }, "company": { "name": "companyName" }, "price": "flightPrice", "seatNumber": "seatNumber" }
- delete flight
DELETE /flights/{id}
- update flight
PUT /flights
Flight JSON body: { "id": "flightId", "route": { "id": "routeId", "departure": { "id": "departureId", "name": "departureName" }, "destination": { "id": "destinationId", "name": "destinationName" } }, "date": "flightDate", "price": "flightPrice", "seatNumber": "seatNumber" }
- TICKET
- get all tickets
GET /tickets
- get ticket by id
GET /tickets/{id}
- add ticket
POST /tickets
Ticket JSON body: { "flight": { "id": "flightId" }, "creditCardNumber": "creditCardNumber", "status": "ticketStatus" }
- delete ticket
DELETE /tickets/{id}
- update ticket
PUT /tickets
Ticket JSON body: { "id": "ticketId", "flight": { "id": "flightId", "route": { "id": "routeId", "departure": { "id": "departureId", "name": "departureName" }, "destination": { "id": "destinationId", "name": "destinationName" } }, "date": "flightDate", "price": "flightPrice", "seatNumber": "seatNumber" }, "creditCardNumber": "creditCardNumber", "status": "ticketStatus" }