aviationstack

❥ Sponsor

I wonder how many startup ideas have something to do with air travel? 🤔

It’s such a big industry with so many pain points its no wonder that it inspires ideas for building new products. Here’s the thing about a lot of startup ideas: you need data. Chances are, you need good to get that data and do interesting things in ways that nobody has done as well as you are going to do.

So if your thing is about air travel, you’re in luck, because there is a great API you can use with all the data you’ll need: aviationstack.

You can test out the API for free for up to 500 requests, then jump up to whatever plan you need for what you are building. You can scale up anytime.

Here’s their code snippet for jQuery, showing how you can ask for flights in real time:

$.ajax({
  url: 'https://api.aviationstack.com/v1/flights',
  data: {
    access_key: 'YOUR_ACCESS_KEY'
  },
  dataType: 'json',
  success: function(apiResponse) {
    if (Array.isArray(apiResponse['results'])) {
      apiResponse['results'].forEach(flight => {
        if (!flight['live']['is_ground']) {
          console.log(`${flight['airline']['name']} flight ${flight['flight']['iata']}`,
            `from ${flight['departure']['airport']} (${flight['departure']['iata']})`,
            `to ${flight['arrival']['airport']} (${flight['arrival']['iata']}) is in the air.`);
        }
      });
    }
  }
});

That’ll get you a bunch of JSON back to do with what you will. Example:

{
  "pagination": {
    "limit": 100,
    "offset": 0,
    "count": 100,
    "total": 1669022
  },
  "data": [
    {
      "flight_date": "2019-12-12",
      "flight_status": "active",
      "departure": {
        "airport": "San Francisco International",
        "timezone": "America/Los_Angeles",
        "iata": "SFO",
        "icao": "KSFO",
        "terminal": "2",
        "gate": "D11",
        "delay": 13,
        "scheduled": "2019-12-12T04:20:00+00:00",
        "estimated": "2019-12-12T04:20:00+00:00",
        "actual": "2019-12-12T04:20:13+00:00",
        "estimated_runway": "2019-12-12T04:20:13+00:00",
        "actual_runway": "2019-12-12T04:20:13+00:00"
      },
      "arrival": {
        "airport": "Dallas/Fort Worth International",
        "timezone": "America/Chicago",
        "iata": "DFW",
        "icao": "KDFW",
        "terminal": "A",
        "gate": "A22",
        "baggage": "A17",
        "delay": 0,
        "scheduled": "2019-12-12T04:20:00+00:00",
        "estimated": "2019-12-12T04:20:00+00:00",
        "actual": null,
        "estimated_runway": null,
        "actual_runway": null
      },
      "airline": {
        "name": "American Airlines",
        "iata": "AA",
        "icao": "AAL"
       },
       "flight": {
         "number": "1004",
         "iata": "AA1004",
         "icao": "AAL1004",
         "codeshared": null
       },
       "aircraft": {
         "registration": "N160AN",
         "iata": "A321",
         "icao": "A321",
         "icao24": "A0F1BB"
       },
       "live": {
         "updated": "2019-12-12T10:00:00+00:00",
         "latitude": 36.28560000,
         "longitude": -106.80700000,
         "altitude": 8846.820,
         "direction": 114.340,
         "speed_horizontal": 894.348,
         "speed_vertical": 1.188,
         "is_ground": false
       }
     }, 
    [...]
  ]
}

This API is made by apilayer, which seems like a darn smart idea for a company. They make really specific APIs for all sorts of developer tasks.

Direct Link →