BalleAir was a challenge proposed by the Ballerini Community. The project consisted of creating an API in which it was possible to list, book and cancel airline flights.
To improve the proposed challenge, I added a user registration with two types of users that are travelers and airline. Travelers can book and cancel flights. The airline can create and delete flights. One important thing is that anyone can create a traveler account, but only I with the superuser account can create airline accounts.
username = Latam
password = balleair-latam
username = Azul
password = balleair-azul
username = Gol
password = balleair-gol
All users API functions are preceded by /users/ on the root url
- POST: register/traveler/
Return all informations of the new travler.
body:{ owner: { "username": string, "email": string, "password": string } }
Return access and refresh tokens of the user.
body:{ "username": string, "password": string }
Return all informations of the user.
headers:{ 'Authorization': 'Bearer {accesstoken}' }
All flights API functions are preceded by /flights/ on the root url
- POST: create/
Return all informations of the new flight.
body:{ "pax": { "available": number }, "departure_airport": string, "arrival_airport": string, "flight_date": string (datetime -> 2022-06-07T10:30), "aircraft": string }headers:
{ 'Authorization': 'Bearer {airline_accesstoken}' }
Return all flights from the authenticated airline.
headers:{ 'Authorization': 'Bearer {airline_accesstoken}' }
Return specific flight from the authenticated airline and give you the access to handle this flight.
body:{ "pax": { "available": number }, "departure_airport": string, "arrival_airport": string, "flight_date": string (datetime -> 2022-06-07T10:30), "aircraft": string }headers:
{ 'Authorization': 'Bearer {airline_accesstoken}' }
Return specific flight from the authenticated airline based on some query parameters.
possible query parameters:airline = number -> airline_id, departure_airport = string, arrival_airport = string, flight_date = string (datetime -> 2022-06-07T10:30),headers:
{ 'Authorization': 'Bearer {airline_flight_owner_accesstoken}' }
Book a flight.
headers:{ 'Authorization': 'Bearer {traveler_accesstoken}' }
Cancel a flight booked before.
headers:{ 'Authorization': 'Bearer {traveler_accesstoken}' }
Return all airports available.
headers:{ 'Authorization': 'Bearer {accesstoken}' }
Return all aircrafts available.
headers:{ 'Authorization': 'Bearer {accesstoken}' }