An open API service indexing awesome lists of open source software.

https://github.com/mrjackwills/adsbdb

public api for aircraft, airlines, & flightroutes
https://github.com/mrjackwills/adsbdb

adsbd aircraft async axum rust tokio

Last synced: 7 months ago
JSON representation

public api for aircraft, airlines, & flightroutes

Awesome Lists containing this project

README

          



api.adsbdb.com


public aircraft, airline, and flightroute api

Built in Rust,
with axum,
for Docker,
using PostgreSQL
& Redis


See typescript branch for original typescript version



check adsbdb twitter for any status updates,
and please report any incorrect data to the issues page, with the Data tag.


With thanks to;


  • PlaneBase for the aircraft data.


  • The flight route data is the work of David Taylor, Edinburgh and Jim Mason, Glasgow, and may not be copied, published, or incorporated into other databases without the explicit permission of David J Taylor, Edinburgh.


  • Guillaume Michel, for the icao to n-number conversion


  • airport-data for aircraft photographs

  • ## GET Routes

    ```https://api.adsbdb.com/v[semver.major]/aircraft/[MODE_S || REGISTRATION]```
    ```json
    {
    "response":{
    "aircraft":{
    "type": string,
    "icao_type": string,
    "manufacturer": string,
    "mode_s": string,
    "registration": string,
    "registered_owner_country_iso_name": string,
    "registered_owner_country_name": string,
    "registered_owner_operator_flag_code": string || null,
    "registered_owner": string,
    "url_photo": string || null,
    "url_photo_thumbnail": string || null
    }
    }
    }

    ```

    Unknown aircraft return status 404 with
    ```json
    { "response": "unknown aircraft"}
    ```
    ---

    ```https://api.adsbdb.com/v[semver.major]/callsign/[CALLSIGN]```
    ```json
    {
    "response": {
    "flightroute":{
    "callsign": string,

    "callsign_icao": string || null,
    "callsign_iata": string || null,

    "airline": {
    "name": string,
    "icao": string,
    "iata": string || null,
    "country": string,
    "country_iso": string,
    "callsign": string || null
    } || null,

    "origin": {
    "country_iso_name": string,
    "country_name": string,
    "elevation": number,
    "iata_code": string,
    "icao_code": string,
    "latitude": number,
    "longitude": number,
    "municipality": string,
    "name": string,
    },

    "destination": {
    "country_iso_name": string,
    "country_name": string,
    "elevation": number,
    "iata_code": string,
    "icao_code": string,
    "latitude": number,
    "longitude": number,
    "municipality": string,
    "name": string,
    }
    }
    }
    }
    ```

    For a small number of flightroutes, midpoints are also included
    ```json
    {
    "midpoint": {
    "country_iso_name": string,
    "country_name": string,
    "elevation": number,
    "iata_code": string,
    "icao_code": string,
    "latitude": number,
    "longitude": number,
    "municipality": string,
    "name": string,
    }
    }
    ```

    Unknown callsign return status 404 with
    ```json
    { "response": "unknown callsign"}
    ```
    ---

    ```https://api.adsbdb.com/v[semver.major]/aircraft/[MODE_S || REGISTRATION]?callsign=[CALLSIGN]```

    ```json
    {
    "response": {

    "aircraft":{
    "type": string,
    "icao_type": string,
    "manufacturer": string,
    "mode_s": string,
    "registration": string,
    "registered_owner_country_iso_name": string,
    "registered_owner_country_name": string,
    "registered_owner_operator_flag_code": string || null,
    "registered_owner": string,
    "url_photo": string || null,
    "url_photo_thumbnail": string || null
    },

    "flightroute":{
    "callsign": string,

    "callsign_icao": string || null,
    "callsign_iata": string || null,

    "airline": {
    "name": string,
    "icao": string,
    "iata": string || null,
    "country": string,
    "country_iso": string,
    "callsign": string || null
    } || null,

    "origin": {
    "country_iso_name": string,
    "country_name": string,
    "elevation": number,
    "iata_code": string,
    "icao_code": string,
    "latitude": number,
    "longitude": number,
    "municipality": string,
    "name": string,
    },

    "destination": {
    "country_iso_name": string,
    "country_name": string,
    "elevation": number,
    "iata_code": string,
    "icao_code": string,
    "latitude": number,
    "longitude": number,
    "municipality": string,
    "name": string,
    }
    }
    }
    }
    ```

    If an unknown callsign is provided as a query param, but the aircraft is known, response will be status 200 with just aircraft

    ---

    ```https://api.adsbdb.com/v[semver.major]/airline/[AIRLINE_ICAO || AIRLINE_IATA ]```
    ```json
    {
    "response":{
    [
    {
    "name": string,
    "icao": string,
    "iata": string || null,
    "country": string,
    "country_iso": string,
    "callsign": string || null
    },
    ...
    ]
    }
    }

    ```

    Unknown airline return status 404 with
    ```json
    { "response": "unknown airline"}
    ```
    ---

    Convert from MODE-S string to N-Number string
    ```https://api.adsbdb.com/v[semver.major]/mode-s/[MODE_S]```
    ```json
    { "response": string }

    ```
    ---

    Convert from N-Number string to Mode_S string
    ```https://api.adsbdb.com/v[semver.major]/n-number/[N-NUMBER]```
    ```json
    { "response": string }

    ```

    ## PATCH Routes

    When `env.allow_update` and `env.argon_hash` are correctly set, and the PATCH request contains a valid `Authorization` header, Aircraft and Callsign can be modified.

    ```https://api.adsbdb.com/v[semver.major]/aircraft/[MODE_S]```

    ```
    {
    "type": string,
    "icao_type": string,
    "manufacturer": string,
    "mode_s": string,
    "registration": string,
    "registered_owner_country_iso_name": string,
    "registered_owner_country_name": string,
    "registered_owner_operator_flag_code": string || null,
    "registered_owner": string,
    "url_photo": string || null,
    "url_photo_thumbnail": string || null
    }
    ```
    Warning: `mode_s`, `url_photo`, and `url_photo_thumbnail` cannot be modified.

    ---

    ```https://api.adsbdb.com/v[semver.major]/callsign/[CALLSIGN]```

    ```
    {
    "origin": string,
    "destination": string
    }
    ```
    Warning: Both `origin` and `destination` need to be valid ICAO airport codes.

    ---

    ## Download

    See releases

    download one liner

    ```bash
    wget https://www.github.com/mrjackwills/adsbdb/releases/latest/download/adsbdb_linux_x86_64.tar.gz &&
    tar xzvf adsbdb_linux_x86_64.tar.gz adsbdb
    ```

    ### Run

    Operate docker compose containers via

    ```bash
    ./run.sh
    ```

    ### Build

    ```bash
    cargo build --release
    ```

    Build using cross, for x86_64 linux musl targets, in order to run in an Alpine based container

    ```bash
    cross build --target x86_64-unknown-linux-musl --release
    ```

    ## Tests

    Requires both postgres, seeded with data, and redis, operational

    ```bash
    # Watch
    cargo watch -q -c -w src/ -x 'test -- --test-threads=1 --nocapture'

    # Run all
    cargo test -- --test-threads=1 --nocapture
    ```