{"swagger":"2.0","info":{"description":"SOEC Task 6.1 The following code is a possible solution for a Airport API","version":"1.0.0","title":"A6-Airport API","license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"basePath":"/v1","tags":[{"name":"Customer","description":"Information about the Customers"},{"name":"Flight","description":"Information about the Flights"},{"name":"Flight Carrier","description":"Information about the Flight Carriers"}],"securityDefinitions":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-KEY"}},"security":[{"ApiKeyAuth":[]}],"schemes":["https","http"],"paths":{"/customers":{"get":{"tags":["Customer"],"summary":"Get Customers","description":"Get all of the Customers, if there is no identifier given within the Request Body","consumes":["application/json"],"parameters":[{"in":"body","name":"Identifiers","description":"One or several identifiers for customer lookup such as customerId, phone number and/or email address","required":false,"schema":{"$ref":"#/definitions/CustomerLookup"}}],"produces":["application/json"],"responses":{"200":{"description":"Request Successful","schema":{"type":"array","items":{"$ref":"#/definitions/Customer"}}},"401":{"description":"Unauthorized. Authorization information is missing or invalid."},"403":{"description":"Forbidden."},"404":{"description":"Ressource not found."}}},"post":{"tags":["Customer"],"summary":"Create new Customers","description":"Create a new Customer","consumes":["application/json"],"parameters":[{"in":"body","name":"Customer","description":"Customer","required":false,"schema":{"$ref":"#/definitions/Customer"}}],"produces":["application/json"],"responses":{"201":{"description":"Request Successful","schema":{"type":"object","properties":{"customerId":{"type":"string"}}}},"401":{"description":"Unauthorized. Authorization information is missing or invalid."},"403":{"description":"Forbidden."},"404":{"description":"Ressource not found."}}}},"/customers/{customer_id}":{"get":{"tags":["Customer"],"summary":"Get Customer","description":"Get Customer by it's customerId","parameters":[{"name":"customer_id","in":"path","description":"ID of customer to return","required":true,"type":"string"}],"produces":["application/json"],"responses":{"200":{"description":"Request Successful","schema":{"$ref":"#/definitions/Customer"}},"401":{"description":"Unauthorized. Authorization information is missing or invalid."},"403":{"description":"Forbidden."},"404":{"description":"Ressource not found."}}},"put":{"tags":["Customer"],"summary":"Update Customer","description":"Update Customer. PUT is used to send new Booking objects or replace them.","consumes":["application/json"],"parameters":[{"name":"customer_id","in":"path","description":"ID of customer to return","required":true,"type":"string"},{"name":"Customer","in":"body","description":"Customer object","required":true,"schema":{"$ref":"#/definitions/Customer"}}],"produces":["application/json"],"responses":{"200":{"description":"Request Successful","schema":{"type":"object","properties":{"customerId":{"type":"string"}}}}}}},"/customers/{customer_id}/bookings":{"get":{"tags":["Customer"],"summary":"Get all Bookings from a specific Customer","description":"Get all Bookings from a specific Customer","parameters":[{"name":"customer_id","in":"path","description":"ID of customer to return","required":true,"type":"string"}],"produces":["application/json"],"responses":{"200":{"description":"Request Successful","schema":{"type":"array","items":{"$ref":"#/definitions/Booking"}}},"401":{"description":"Unauthorized. Authorization information is missing or invalid."},"403":{"description":"Forbidden."},"404":{"description":"Ressource not found."}}},"post":{"tags":["Customer"],"summary":"Create new Booking for a specific Customer","description":"Create new Booking for a specific Customer","consumes":["application/json"],"parameters":[{"name":"customer_id","in":"path","description":"ID of customer to return","required":true,"type":"string"},{"name":"booking_id","in":"path","description":"ID of booking to return","required":true,"type":"string"},{"name":"Booking","in":"body","description":"New Booking Object","required":true,"schema":{"$ref":"#/definitions/Booking"}}],"responses":{"201":{"description":"Request Successful","schema":{"type":"object","properties":{"bookingId":{"type":"string","description":"Unique Identifier of the booking"}},"required":["bookingId"]}},"401":{"description":"Unauthorized. Authorization information is missing or invalid."},"403":{"description":"Forbidden."},"404":{"description":"Ressource not found."}}}},"/customers/{customer_id}/bookings/{booking_id}":{"get":{"tags":["Customer"],"summary":"Get Booking from a specific Customer","description":"Get Booking from a specific Customer by booking_id","parameters":[{"name":"customer_id","in":"path","description":"ID of customer to return","required":true,"type":"string"},{"name":"booking_id","in":"path","description":"ID of booking to return","required":true,"type":"string"}],"produces":["application/json"],"responses":{"200":{"description":"Request Successful","schema":{"$ref":"#/definitions/Booking"}},"401":{"description":"Unauthorized. Authorization information is missing or invalid."},"403":{"description":"Forbidden."},"404":{"description":"Ressource not found."}}},"put":{"tags":["Customer"],"summary":"Update Booking from a specific Customer","description":"Update Booking from a specific Customer by booking_id. PUT is used to send new Booking objects or replace them.","consumes":["application/json"],"parameters":[{"name":"customer_id","in":"path","description":"ID of customer to return","required":true,"type":"string"},{"name":"booking_id","in":"path","description":"ID of booking to return","required":true,"type":"string"},{"name":"Booking","in":"body","description":"New Booking Object","required":true,"schema":{"$ref":"#/definitions/Booking"}}],"responses":{"204":{"description":"Request Successful"},"401":{"description":"Unauthorized. Authorization information is missing or invalid."},"403":{"description":"Forbidden."},"404":{"description":"Ressource not found."}}},"patch":{"tags":["Customer"],"summary":"Update Booking from a specific Customer","description":"Same as the PUT method, but the objects that have to be updated have to be present, other objects that are not specified are considered unchanged. This is also used to cancel flights, so no data is missing.","consumes":["application/json"],"parameters":[{"name":"customer_id","in":"path","description":"ID of customer to return","required":true,"type":"string"},{"name":"booking_id","in":"path","description":"ID of booking to return","required":true,"type":"string"},{"name":"Booking","in":"body","description":"New Booking Object","required":true,"schema":{"type":"object","example":{"cancelled":true}}}],"responses":{"204":{"description":"Request Successful"},"401":{"description":"Unauthorized. Authorization information is missing or invalid."},"403":{"description":"Forbidden."},"404":{"description":"Ressource not found."}}}},"/flights":{"get":{"tags":["Flight"],"summary":"Get Flights","description":"Get all Flights","produces":["application/json"],"responses":{"200":{"description":"Request Successful","schema":{"$ref":"#/definitions/Flight"}},"401":{"description":"Unauthorized. Authorization information is missing or invalid."},"403":{"description":"Forbidden."},"404":{"description":"Ressource not found."}}}},"/flights/{flight_id}":{"get":{"tags":["Flight"],"summary":"Get Flight","description":"Get specific Flight by it's flight_id","parameters":[{"name":"flight_id","in":"path","description":"ID of flight to return","required":true,"type":"string"}],"produces":["application/json"],"responses":{"200":{"description":"Request Successful","schema":{"$ref":"#/definitions/Flight"}},"401":{"description":"Unauthorized. Authorization information is missing or invalid."},"403":{"description":"Forbidden."},"404":{"description":"Ressource not found."}}}},"/flights/{flight_id}/bookings":{"get":{"tags":["Flight"],"summary":"Get all Bookings from a specific Flight","description":"Get all Bookings from a specific Flight","parameters":[{"name":"flight_id","in":"path","description":"ID of customer to return","required":true,"type":"string"}],"produces":["application/json"],"responses":{"200":{"description":"Request Successful","schema":{"type":"array","items":{"$ref":"#/definitions/Booking"}}},"401":{"description":"Unauthorized. Authorization information is missing or invalid."},"403":{"description":"Forbidden."},"404":{"description":"Ressource not found."}}}},"/flights/{flight_id}/bookings/{booking_id}":{"get":{"tags":["Flight"],"summary":"Get Booking from a specific Flight","description":"Get Booking from a specific Flight by booking_id","parameters":[{"name":"flight_id","in":"path","description":"ID of customer to return","required":true,"type":"string"},{"name":"booking_id","in":"path","description":"ID of booking to return","required":true,"type":"string"}],"produces":["application/json"],"responses":{"200":{"description":"Request Successful","schema":{"$ref":"#/definitions/Booking"}},"401":{"description":"Unauthorized. Authorization information is missing or invalid."},"403":{"description":"Forbidden."},"404":{"description":"Ressource not found."}}}},"/carrier":{"get":{"tags":["Flight Carrier"],"summary":"Get Flight Carriers","description":"Get all Flight Carriers.","produces":["application/json"],"responses":{"200":{"description":"Request Successful","schema":{"type":"array","items":{"$ref":"#/definitions/Carrier"}}},"401":{"description":"Unauthorized. Authorization information is missing or invalid."},"403":{"description":"Forbidden."},"404":{"description":"Ressource not found."}}}},"/carrier/{carrier_id}":{"get":{"tags":["Flight Carrier"],"summary":"Get Flight Carrier","description":"Get one Flight Carrier.","parameters":[{"name":"carrier_id","in":"path","description":"ID of carrier to return","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Carrier"}},"401":{"description":"Unauthorized. Authorization information is missing or invalid."},"403":{"description":"Forbidden."},"404":{"description":"Ressource not found."}}}}},"definitions":{"CustomerLookup":{"type":"object","properties":{"identifier":{"type":"string","enum":["EMAIL","PHONENO","CUSTOMER_ID"],"description":"Key of customer identifier."},"value":{"type":"string","description":"Value of customer identifier."}},"required":["identifier","value"]},"Customer":{"properties":{"customerId":{"type":"string","description":"Unique Identifier of customer"},"firstName":{"type":"string","description":"Firstname of customer."},"lastName":{"type":"string","description":"Lastname of customer."},"language":{"type":"string","description":"Language Code (ISO 639-1 alpha-2) of Customer"},"emailAddress":{"type":"string","description":"Email address of customer."},"phoneNo":{"type":"string","description":"Phone number (MSISDN according E.164 standard) of customer (mobile or landline)"},"countryCode":{"type":"string","description":"Country code (2-chars according ISO 3166-1 alpha-2) of customer"},"StreetHouseNo":{"type":"string","description":"Postal address of the customers city of residence (concatenated street name and housenumber, if existent)."},"postalCode":{"type":"string","description":"Postal code of customers city."},"city":{"type":"string","description":"City of customer."},"state":{"type":"string","description":"State in which the Customer resides"}},"required":["customerId","firstName","lastName","emailAdress","phoneNo","countryCode","StreetHouseNo","postalCode","city"]},"Flight":{"properties":{"flightId":{"type":"string","description":"Unique Identifier of flight"},"carrierId":{"type":"string","description":"Unique Identifier of flight carrier"},"flightDate":{"type":"string","format":"date","description":"Date of flight"},"seatMax":{"type":"integer","description":"Max Amount of Seats in this flight"},"seatTak":{"type":"integer","description":"Amount of taken Seats in this flight"},"price":{"type":"number","description":"Price of this flight"},"currency":{"type":"string","description":"ISO 4217 code for currency. Default: EUR"},"planeType":{"type":"string","description":"Type of Plane which is used for this flight"},"airportFrom":{"type":"string","description":"Airport where this flight is launched"},"airportTo":{"type":"string","description":"Airport where this flight arrives"},"cityFrom":{"type":"string","description":"City where this flight is launched"},"cityTo":{"type":"string","description":"City where the flight arrives"},"countryFrom":{"type":"string","description":"Country where this flight is launched"},"countryTo":{"type":"string","description":"Country where this flight arrives"}},"required":["flightId","carrierId","flightDate","seatMax","seatTak","price","currency","airportFrom","airportTo"]},"Booking":{"properties":{"bookingId":{"type":"string","description":"Unique Identifier of booking"},"customerId":{"type":"string","description":"Unique Identifier of customer"},"flightId":{"type":"string","description":"Unique Identifier of flight"},"carrierId":{"type":"string","description":"Unique Identifier of flight carrier"},"flightDate":{"type":"string","format":"date","description":"Date of flight"},"luggageWeight":{"type":"number","description":"Weight of luggage"},"weightUnit":{"type":"string","description":"Measurement unit of luggage weight"},"cancelled":{"type":"boolean","description":"Bool if Booking was cannceled"}},"required":["bookingId","customerId","flightId","carrierId","flightDate","luggageWeight"]},"Carrier":{"properties":{"carrierId":{"type":"string","description":"Unique Identifier of flight carrier"},"name":{"type":"string","description":"Full name of Flight Carrier"}}}}}