### Install AirTrail with Local Install Script Source: https://airtrail.johan.ohly.dk/docs/install/one-click Run this command to download Docker Compose files and start AirTrail services locally. This script is experimental and may not work on all systems. ```bash bash <(curl -o- https://raw.githubusercontent.com/JohanOhly/AirTrail/main/scripts/install.sh) ``` -------------------------------- ### Install Dependencies with Bun Source: https://airtrail.johan.ohly.dk/docs/install/manual Install the project's dependencies using the Bun package manager. ```bash bun install ``` -------------------------------- ### Configure Environment Variables Source: https://airtrail.johan.ohly.dk/docs/install/manual Copy the example environment file to create a new .env file for your configuration. ```bash cp .env.example .env ``` -------------------------------- ### Build the App for Manual Installation Source: https://airtrail.johan.ohly.dk/docs/install/updating Rebuild the AirTrail application after installing dependencies using this command. ```bash bun run build ``` -------------------------------- ### Run AirTrail Installation Script Source: https://airtrail.johan.ohly.dk Execute this command on Linux systems with Docker preinstalled to install AirTrail. After installation, AirTrail will be accessible at http://localhost:3000. ```bash $ ``` -------------------------------- ### Start AirTrail Server Source: https://airtrail.johan.ohly.dk/docs/install/manual Start the AirTrail application server. The app will be accessible on localhost:3000. ```bash node ./build ``` -------------------------------- ### Manual Installation Environment Variables for Outbound Proxy Source: https://airtrail.johan.ohly.dk/docs/administration/outbound-proxy Set these environment variables before starting the AirTrail process manually to direct outbound traffic through a proxy. This method is useful for non-Docker deployments. ```bash NODE_USE_ENV_PROXY=1 \ HTTPS_PROXY=http://proxy.example.com:8080 \ HTTP_PROXY=http://proxy.example.com:8080 \ NO_PROXY=localhost,127.0.0.1 \ node ./build ``` -------------------------------- ### Pull Latest Changes for Manual Installation Source: https://airtrail.johan.ohly.dk/docs/install/updating Navigate to your AirTrail installation directory and run this command to fetch the latest code from the repository. ```bash git pull ``` -------------------------------- ### Run Database Migrations for Manual Installation Source: https://airtrail.johan.ohly.dk/docs/install/updating Execute this command to apply any necessary database migrations after updating. This is crucial to avoid data loss. ```bash bun run db:migrate-deploy ``` -------------------------------- ### Start AirTrail Application Source: https://airtrail.johan.ohly.dk/docs/install/docker-compose Starts the AirTrail application in detached mode using Docker Compose. Ensure you are in the directory containing the `docker-compose.yml` and `.env` files. ```bash docker compose up -d ``` -------------------------------- ### List Available Admin CLI Commands Source: https://airtrail.johan.ohly.dk/docs/administration/admin-cli Run this command to get a list of all available commands for the airtrail-admin CLI. ```bash docker exec -it airtrail airtrail-admin help ``` -------------------------------- ### Save Flight Request Example Source: https://airtrail.johan.ohly.dk/docs/api/flight/save-flight This cURL example demonstrates how to send a POST request to save a new flight. Ensure you replace `` with a valid user identifier. ```cURL curl -X POST "https://your-instance.com/api/flight/save" \ -H "Content-Type: application/json" \ -d '{ "from": "KJFK", "to": "EGLL", "departure": "2022-01-01", "seats": [ { "userId": "" } ] }' ``` -------------------------------- ### Update AirTrail with Docker Compose Source: https://airtrail.johan.ohly.dk/docs/install/updating Use this command to update your AirTrail installation when using Docker Compose. Ensure you are in the directory containing your docker-compose.yml and .env files. ```bash docker compose pull && docker compose up -d ``` -------------------------------- ### List Flights Success Response Source: https://airtrail.johan.ohly.dk/docs/api/flight/list-flights This is an example of a successful JSON response when listing flights. It includes details for each flight, such as origin, destination, departure/arrival times, and seat information. ```json { "flights": [ { "id": 1, "from": { "id": 42, "icao": "KJFK", "iata": "JFK", "name": "John F Kennedy International Airport", "lat": 40.639447, "lon": -73.779317, "type": "large_airport", "continent": "NA", "country": "US", "tz": "America/New_York" }, "to": { "id": 42, "icao": "KJFK", "iata": "JFK", "name": "John F Kennedy International Airport", "lat": 40.639447, "lon": -73.779317, "type": "large_airport", "continent": "NA", "country": "US", "tz": "America/New_York" }, "departure": "2021-09-01T23:00:00.000+00:00", "arrival": "2021-09-02T10:00:00.000+00:00", "date": "2021-09-02", "datePrecision": "day", "seats": [ { "userId": "user1", "guestName": null, "seat": "aisle", "seatNumber": "1A", "seatClass": "economy" } ], "airline": "BAW", "flightNumber": "BA178", "aircraft": "A388", "aircraftReg": "G-VIIL", "flightReason": "leisure", "notes": "This is a test flight." } ] } ``` -------------------------------- ### Get Flight Details (cURL) Source: https://airtrail.johan.ohly.dk/docs/api/flight/get-flight Use this cURL command to retrieve details for a specific flight by its ID. Replace '0' with the actual flight ID. ```bash curl -X GET "https://your-instance.com/api/flight/get/0" ``` -------------------------------- ### Get Flight Details Source: https://airtrail.johan.ohly.dk/docs/api/flight/get-flight Retrieves the details of a specific flight using its ID. Requires Bearer token authentication. ```APIDOC ## GET /flight/get/{id} ### Description Get details of a specific flight by ID. ### Method GET ### Endpoint /flight/get/{id} ### Parameters #### Path Parameters - **id** (number) - Required - The ID of the flight to retrieve. #### Header Parameters - **Authorization** (string) - Required - Bearer ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **flight** (object) - Contains the flight details. - **id** (number) - The unique identifier for the flight. - **from** (object) - Details of the departure airport. - **to** (object) - Details of the arrival airport. - **departure** (string) - The scheduled departure date and time. - **arrival** (string) - The scheduled arrival date and time. - **date** (string) - The date of the flight. - **datePrecision** (string) - The precision of the flight date. - **seats** (array) - An array of seat information. - **airline** (string) - The airline code. - **flightNumber** (string) - The flight number. - **aircraft** (string) - The aircraft type. - **aircraftReg** (string) - The aircraft registration. - **flightReason** (string) - The reason for the flight. - **notes** (string) - Additional notes about the flight. #### Error Response (400) - **success** (boolean) - Indicates if the request was successful. - **message** (string) - Description of the error. #### Error Response (401) - **success** (string) - Indicates if the request was successful. - **message** (string) - Description of the error. #### Error Response (403) - **success** (string) - Indicates if the request was successful. - **message** (string) - Description of the error. #### Error Response (500) - **success** (string) - Indicates if the request was successful. - **message** (string) - Description of the error. ### Request Example ```json { "example": "request body" } ``` ### Response Example (200 OK) ```json { "success": true, "flight": { "id": 1, "from": { "id": 42, "icao": "KJFK", "iata": "JFK", "name": "John F Kennedy International Airport", "lat": 40.639447, "lon": -73.779317, "type": "large_airport", "continent": "NA", "country": "US", "tz": "America/New_York" }, "to": { "id": 42, "icao": "KJFK", "iata": "JFK", "name": "John F Kennedy International Airport", "lat": 40.639447, "lon": -73.779317, "type": "large_airport", "continent": "NA", "country": "US", "tz": "America/New_York" }, "departure": "2021-09-01T23:00:00.000+00:00", "arrival": "2021-09-02T10:00:00.000+00:00", "date": "2021-09-02", "datePrecision": "day", "seats": [ { "userId": "user1", "guestName": null, "seat": "aisle", "seatNumber": "1A", "seatClass": "economy" } ], "airline": "BAW", "flightNumber": "BA178", "aircraft": "A388", "aircraftReg": "G-VIIL", "flightReason": "leisure", "notes": "This is a test flight." } } ``` ### Response Example (400 Bad Request) ```json { "success": false, "message": "Flight id is not a number" } ``` ### Response Example (401 Unauthorized) ```json { "success": "false", "message": "Unauthorized" } ``` ### Response Example (403 Forbidden) ```json { "success": "false", "message": "Forbidden" } ``` ### Response Example (500 Internal Server Error) ```json { "success": "false", "message": "string" } ``` ``` -------------------------------- ### Successful Flight Response Source: https://airtrail.johan.ohly.dk/docs/api/flight/get-flight This is an example of a successful JSON response when retrieving flight details. It includes comprehensive information about the flight, its origin, destination, and passenger seats. ```json { "success": true, "flight": { "id": 1, "from": { "id": 42, "icao": "KJFK", "iata": "JFK", "name": "John F Kennedy International Airport", "lat": 40.639447, "lon": -73.779317, "type": "large_airport", "continent": "NA", "country": "US", "tz": "America/New_York" }, "to": { "id": 42, "icao": "KJFK", "iata": "JFK", "name": "John F Kennedy International Airport", "lat": 40.639447, "lon": -73.779317, "type": "large_airport", "continent": "NA", "country": "US", "tz": "America/New_York" }, "departure": "2021-09-01T23:00:00.000+00:00", "arrival": "2021-09-02T10:00:00.000+00:00", "date": "2021-09-02", "datePrecision": "day", "seats": [ { "userId": "user1", "guestName": null, "seat": "aisle", "seatNumber": "1A", "seatClass": "economy" } ], "airline": "BAW", "flightNumber": "BA178", "aircraft": "A388", "aircraftReg": "G-VIIL", "flightReason": "leisure", "notes": "This is a test flight." } } ``` -------------------------------- ### Delete Flight cURL Example Source: https://airtrail.johan.ohly.dk/docs/api/flight/delete-flight Use this cURL command to send a POST request to delete a flight. Ensure you replace 'your-instance.com' with your actual instance URL. The request body is currently an empty JSON object, but the 'id' field is expected in the actual request. ```cURL curl -X POST "https://your-instance.com/api/flight/delete" \ -H "Content-Type: application/json" \ -d '{}' ``` -------------------------------- ### Build and Deploy Database Source: https://airtrail.johan.ohly.dk/docs/install/manual Build the application and deploy the database migrations. ```bash bun run build bun run db:migrate-deploy ``` -------------------------------- ### Download Docker Compose Files Source: https://airtrail.johan.ohly.dk/docs/install/docker-compose Downloads the `docker-compose.yml` and `.env.example` files from the official AirTrail GitHub repository using wget. The `.env.example` file should be renamed to `.env` if downloaded manually. ```bash wget -O docker-compose.yml https://raw.githubusercontent.com/JohanOhly/AirTrail/main/docker/production/compose.yml wget -O .env https://raw.githubusercontent.com/JohanOhly/AirTrail/main/.env.example ``` -------------------------------- ### List All Users Source: https://airtrail.johan.ohly.dk/docs/administration/admin-cli Use this command to display all users, their roles, and account details. The output includes username, display name, role, OAuth status, and user ID. ```bash docker exec -it airtrail airtrail-admin list-users ``` -------------------------------- ### Print AirTrail Version Source: https://airtrail.johan.ohly.dk/docs/administration/admin-cli Display the current version of the AirTrail instance. ```bash docker exec -it airtrail airtrail-admin version ``` -------------------------------- ### Create AirTrail Directory Source: https://airtrail.johan.ohly.dk/docs/install/docker-compose Creates a new directory named 'airtrail' and navigates into it. This directory will hold the Docker Compose configuration files. ```bash mkdir airtrail cd airtrail ``` -------------------------------- ### Clone AirTrail Repository Source: https://airtrail.johan.ohly.dk/docs/install/manual Clone the AirTrail repository to your local machine and navigate into the project directory. ```bash git clone https://github.com/JohanOhly/AirTrail.git cd AirTrail ``` -------------------------------- ### Docker Compose for AirTrail Stack Source: https://airtrail.johan.ohly.dk/docs/install/portainer This is the docker-compose.yml content to be used when creating a new stack in Portainer. ```yaml version: "3.7" services: airtrail: image: "portainer/portainer-ce:latest" container_name: "airtrail" restart: "unless-stopped" ports: - "8000:8000" - "9443:9443" volumes: - "/var/run/docker.sock:/var/run/docker.sock" - "airtrail_data:/data" volumes: airtrail_data: ``` -------------------------------- ### Execute Admin CLI Command Source: https://airtrail.johan.ohly.dk/docs/administration/admin-cli General syntax for running any airtrail-admin command inside a running container. Replace with your AirTrail container's name. ```bash docker exec -it airtrail-admin ``` -------------------------------- ### Environment Variables for AirTrail Stack Source: https://airtrail.johan.ohly.dk/docs/install/portainer This is the content for the stack.env file, which should be pasted into the 'Environment variables' section in Portainer's advanced mode. ```env # Portainer Environment Variables # The origin URL that you will be accessing your AirTrail instance from. # You can pass multiple URLs in a comma-separated list. ORIGIN=http://localhost:8000 # Database settings # Change the DB_PASSWORD to a secure password. # Optionally, change other database settings. DB_TYPE=sqlite DB_HOST= DB_PORT= DB_USER= DB_PASSWORD=changeme DB_NAME=portainer # Other settings # LOG_LEVEL=debug # ENABLE_TELEMETRY=false ``` -------------------------------- ### List Flights cURL Request Source: https://airtrail.johan.ohly.dk/docs/api/flight/list-flights Use this cURL command to list flights visible to your API key. Ensure you replace 'your-instance.com' with your actual instance URL. ```shell curl -X GET "https://your-instance.com/api/flight/list" ``` -------------------------------- ### Docker Compose Environment Variables for Outbound Proxy Source: https://airtrail.johan.ohly.dk/docs/administration/outbound-proxy Add these environment variables to your Docker Compose file for the AirTrail service to enable proxy support. Ensure the proxy addresses and `NO_PROXY` list are correctly configured for your network. ```bash NODE_USE_ENV_PROXY=1 HTTPS_PROXY=http://proxy.example.com:8080 HTTP_PROXY=http://proxy.example.com:8080 NO_PROXY=localhost,127.0.0.1,db,airtrail_db ``` -------------------------------- ### Grant Admin Role to User Source: https://airtrail.johan.ohly.dk/docs/administration/admin-cli Promote a regular user to the admin role. You will be prompted for the username. This command only affects users with the 'user' role and cannot change the 'owner' role. ```bash docker exec -it airtrail airtrail-admin grant-admin ``` -------------------------------- ### Node.js Environment Variable for Custom CA Certificates Source: https://airtrail.johan.ohly.dk/docs/administration/outbound-proxy If your proxy performs TLS inspection, configure Node.js to trust your organization's certificate authority by setting the `NODE_EXTRA_CA_CERTS` environment variable. Provide the correct path to your corporate CA certificate file. ```bash NODE_EXTRA_CA_CERTS=/path/to/corporate-ca.pem ``` -------------------------------- ### Reset User Password Source: https://airtrail.johan.ohly.dk/docs/administration/admin-cli Interactively reset a user's password. You will be prompted for the username and the new password, which must be at least 8 characters long. Input is hidden and requires confirmation. ```bash docker exec -it airtrail airtrail-admin reset-password ``` -------------------------------- ### Create or Update Flight Source: https://airtrail.johan.ohly.dk/docs/api/flight/save-flight Creates a new flight or updates an existing one. If an `id` is provided, the flight is updated; otherwise, a new flight is created. ```APIDOC ## POST /flight/save ### Description Creates a new flight or updates an existing one. If the `id` field is present, the flight will be updated. Otherwise, a new flight will be created. ### Method POST ### Endpoint /flight/save ### Authorization - **Type**: Bearer Token - **Details**: Use a generated API key from `Settings` -> `Security` as the bearer token. ### Request Body #### `application/json` - **from** (string) - Required - The departure airport code (ICAO or IATA). - **to** (string) - Required - The arrival airport code (ICAO or IATA). - **departure** (string) - Required - The departure date anchor. Accepts either a date-only string (`YYYY-MM-DD`) or a full ISO 8601 datetime. For partial dates, send January 1st for year-only flights and the first day of the month for month-only flights. - **datePrecision?** (string) - Optional - How precise the canonical flight date anchor is. Default: `"day"`. Possible values: `"day" | "month" | "year"`. - **departureTime?** (string) - Optional - The departure time in local airport time. 24- and 12-hour formats are supported. - **arrival?** (string|null) - Optional - The arrival date or datetime. Partial-date flights do not support a separate arrival anchor, so omit this or send null unless `datePrecision` is `day`. - **arrivalTime?** (string) - Optional - The arrival time in local airport time. 24- and 12-hour formats are supported. - **seats** (array) - Required - The seats on the flight. Each seat must have either a `userId` or a `guestName`, and at least one seat must have a `userId`. Minimum 1 item. - **airline?** (string) - Optional - The ICAO code of the airline. - **flightNumber?** (string) - Optional - The flight number. - **aircraft?** (string) - Optional - The ICAO code of the aircraft. - **aircraftReg?** (string) - Optional - The registration of the aircraft. - **flightReason?** (string) - Optional - The reason for the flight. Possible values: `"leisure" | "business" | "crew" | "other"`. - **notes?** (string) - Optional - Additional notes about the flight. - **customFields?** (CustomFieldsInput) - Optional - Custom field values keyed by custom field key. Values must match the configured field type. ### Request Example ```json { "from": "KJFK", "to": "EGLL", "departure": "2022-01-01", "seats": [ { "userId": "" } ] } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **id** (integer) - The ID of the created or updated flight (present on success). #### Error Response - **success** (boolean) - Indicates if the operation was successful. - **errors** (array) - A list of errors if the operation failed. - **message** (string) - A message describing the error (e.g., "Unauthorized", "Forbidden"). #### Response Example (Success) ```json { "success": true, "id": 1 } ``` #### Response Example (Error) ```json { "success": false, "errors": ["string"] } ``` #### Response Example (Unauthorized) ```json { "success": "false", "message": "Unauthorized" } ``` #### Response Example (Forbidden) ```json { "success": "false", "message": "Forbidden" } ``` ``` -------------------------------- ### Error Response: Forbidden Source: https://airtrail.johan.ohly.dk/docs/api/flight/get-flight This JSON response indicates that the authenticated user does not have permission to access the requested resource. ```json { "success": "false", "message": "Forbidden" } ``` -------------------------------- ### Revoke Admin Role from User Source: https://airtrail.johan.ohly.dk/docs/administration/admin-cli Demote an admin user back to a regular user. You will be prompted for the username. ```bash docker exec -it airtrail airtrail-admin revoke-admin ``` -------------------------------- ### List Flights Source: https://airtrail.johan.ohly.dk/docs/api/flight/list-flights Retrieves a list of flights visible to the authenticated API key. Regular users can only list their own flights, while admins and owners have broader access. ```APIDOC ## GET /flight/list ### Description Lists flights visible to the authenticated API key. Regular users can only list their own flights. Admins and owners can also request a specific user's flights or all flights. ### Method GET ### Endpoint /flight/list ### Query Parameters - **scope** (string) - Optional - Which flights to return. `mine` is the default. `user` and `all` require an admin or owner API key. Default: `"mine"`. Allowed values: `"mine" | "user" | "all"` - **userId** (string) - Optional - The user ID whose flights should be returned when `scope=user`. ### Authorization Bearer ### Request Example ``` curl -X GET "https://your-instance.com/api/flight/list?scope=mine&userId=user123" ``` ### Response #### Success Response (200) - **flights** (array) - A list of flight objects. - **id** (integer) - Flight ID. - **from** (object) - Departure location details. - **to** (object) - Arrival location details. - **departure** (string) - Departure timestamp. - **arrival** (string) - Arrival timestamp. - **date** (string) - Flight date. - **datePrecision** (string) - Precision of the date. - **seats** (array) - List of seat assignments. - **airline** (string) - Airline code. - **flightNumber** (string) - Flight number. - **aircraft** (string) - Aircraft type. - **aircraftReg** (string) - Aircraft registration. - **flightReason** (string) - Reason for the flight. - **notes** (string) - Additional notes about the flight. #### Response Example (200 OK) ```json { "flights": [ { "id": 1, "from": { "id": 42, "icao": "KJFK", "iata": "JFK", "name": "John F Kennedy International Airport", "lat": 40.639447, "lon": -73.779317, "type": "large_airport", "continent": "NA", "country": "US", "tz": "America/New_York" }, "to": { "id": 42, "icao": "KJFK", "iata": "JFK", "name": "John F Kennedy International Airport", "lat": 40.639447, "lon": -73.779317, "type": "large_airport", "continent": "NA", "country": "US", "tz": "America/New_York" }, "departure": "2021-09-01T23:00:00.000+00:00", "arrival": "2021-09-02T10:00:00.000+00:00", "date": "2021-09-02", "datePrecision": "day", "seats": [ { "userId": "user1", "guestName": null, "seat": "aisle", "seatNumber": "1A", "seatClass": "economy" } ], "airline": "BAW", "flightNumber": "BA178", "aircraft": "A388", "aircraftReg": "G-VIIL", "flightReason": "leisure", "notes": "This is a test flight." } ] } ``` #### Error Responses - **400 Bad Request**: Invalid scope. ```json { "success": false, "message": "Invalid scope" } ``` - **401 Unauthorized**: Authentication failed. ```json { "success": "false", "message": "Unauthorized" } ``` - **403 Forbidden**: Insufficient permissions. ```json { "success": "false", "message": "Forbidden" } ``` - **500 Internal Server Error**: An unexpected error occurred. ```json { "success": "false", "message": "string" } ``` ``` -------------------------------- ### Error Response with Errors Array Source: https://airtrail.johan.ohly.dk/docs/api/flight/delete-flight This JSON object represents a failed deletion attempt, providing a list of specific errors. ```JSON { "success": false, "errors": [ "string" ] } ``` -------------------------------- ### Successful Flight Save Response Source: https://airtrail.johan.ohly.dk/docs/api/flight/save-flight This JSON object represents a successful response after creating or updating a flight. The `success` field is true, and an `id` is provided if a new flight was created. ```JSON { "success": true } ``` ```JSON { "success": true, "id": 1 } ``` -------------------------------- ### Save Flight with Custom Fields Source: https://airtrail.johan.ohly.dk/docs/features/custom-fields Pass custom field data as a 'customFields' object keyed by field key to the flight save endpoint. Required fields are enforced server-side. ```json { "from": "KJFK", "to": "EGLL", "departure": "2026-02-20", "seats": [{ "userId": "" }], "customFields": { "booking_reference": "ABC123", "delay_minutes": 15 } } ``` -------------------------------- ### JSON Export Format Structure Source: https://airtrail.johan.ohly.dk/docs/features/export This is the structure for the JSON export, detailing user and flight information with nested seat data. It's ideal for developers or system integration. ```json { "users": [ { "id": "user_id", "displayName": "User Name", "username": "username" } ], "flights": [ { "date": "YYYY-MM-DD", "from": "ICAO_CODE", "to": "ICAO_CODE", "departure": "ISO_8601_DATETIME", "arrival": "ISO_8601_DATETIME", "duration": flight_duration_in_seconds, "flightNumber": "FLIGHT_NUMBER", "flightReason": "FLIGHT_REASON", "airline": "ICAO_AIRLINE_CODE", "aircraft": "ICAO_AIRCRAFT_TYPE", "aircraftReg": "AIRCRAFT_REGISTRATION", "note": "FLIGHT_NOTE", "seats": [ { "userId": "USER_ID", "guestName": "GUEST_NAME", "seat": "SEAT_TYPE", "seatNumber": "SEAT_NUMBER", "seatClass": "SEAT_CLASS" } ] } ] } ``` -------------------------------- ### Unauthorized Error Response Source: https://airtrail.johan.ohly.dk/docs/api/flight/delete-flight This JSON object indicates an unauthorized request, likely due to an invalid or missing API key. ```JSON { "success": "false", "message": "Unauthorized" } ``` -------------------------------- ### List Flights Invalid Scope Error Response Source: https://airtrail.johan.ohly.dk/docs/api/flight/list-flights This JSON response indicates an error due to an invalid 'scope' parameter. Ensure the scope is one of the allowed values ('mine', 'user', 'all'). ```json { "success": false, "message": "Invalid scope" } ``` -------------------------------- ### Successful Deletion Response Source: https://airtrail.johan.ohly.dk/docs/api/flight/delete-flight This JSON object indicates a successful deletion of the flight. ```JSON { "success": true } ``` -------------------------------- ### Generic Error Response Source: https://airtrail.johan.ohly.dk/docs/api/flight/delete-flight This JSON object signifies a general error during the flight deletion process, with a descriptive message. ```JSON { "success": "false", "message": "string" } ``` -------------------------------- ### Failed Flight Save Response Source: https://airtrail.johan.ohly.dk/docs/api/flight/save-flight This JSON object indicates a failed attempt to save a flight. The `success` field is false, and an `errors` array details the issues. For unauthorized or forbidden requests, a `message` field is provided. ```JSON { "success": false, "errors": [ "string" ] } ``` ```JSON { "success": "false", "message": "Unauthorized" } ``` ```JSON { "success": "false", "message": "Forbidden" } ``` ```JSON { "success": "false", "message": "string" } ``` -------------------------------- ### Error Response: Invalid Flight ID Source: https://airtrail.johan.ohly.dk/docs/api/flight/get-flight This JSON response indicates an error when the provided flight ID is not a valid number. ```json { "success": false, "message": "Flight id is not a number" } ``` -------------------------------- ### Delete Flight Source: https://airtrail.johan.ohly.dk/docs/api/flight/delete-flight Deletes a flight record using its unique identifier. Authentication is required via a Bearer token. ```APIDOC ## DELETE /flight/delete ### Description Deletes a flight by its ID. ### Method POST ### Endpoint /flight/delete ### Authorization Bearer Use the generated API key from `Settings` -> `Security` as the bearer token. ### Request Body #### Body Parameters - **id** (number) - Optional - The ID of the flight to delete. ### Request Example ```json { "id": 12345 } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. #### Response Example (Success) ```json { "success": true } ``` #### Error Response (400, 401, 500) - **success** (boolean/string) - Indicates if the operation was successful (often false in error cases). - **errors** (array of strings) - A list of errors encountered during the operation (for 400/500 errors). - **message** (string) - A message describing the error (e.g., "Unauthorized" for 401 errors). #### Response Example (Unauthorized) ```json { "success": "false", "message": "Unauthorized" } ``` #### Response Example (Other Error) ```json { "success": "false", "message": "string" } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.