API to Get Fiji Airways (FJ) Flights
Building a Fiji Airways flight display means turning schedule records into useful departure and arrival information without treating a planned time as a live update. This guide shows how to read FlightLabs schedule data, select Fiji Airways records by the airline’s IATA code, FJ, and design for changing times, cancellations and incomplete fields.
Fiji Airways is based in Fiji, with its main hub at Nadi International Airport. Its airline IATA code is FJ.
Choose the right data for an FJ application
The Documentation covers FlightLabs’ REST interface and authentication. For schedules, the request structure is https://api.goflightlabs.com/flights-schedules?iataCode=&type=. Consult the endpoint documentation for the supported iataCode and type values and the API-key authentication format before constructing a request.
A schedule and a live tracking record answer different questions. Use a schedule to display a planned departure or arrival; use live data when the application needs to show a current status, an actual departure or an estimated arrival. A scheduled time alone is not evidence that a flight has departed or will operate as planned.
| Data need | Relevant response fields | What to use them for |
|---|---|---|
| Identify an airline schedule | airline.name, airline.iata, flight_number |
Select records whose airline IATA code is FJ and display the returned flight identifier. |
| Show a planned journey | departure.airport, departure.scheduled, arrival.airport, arrival.scheduled |
Display the returned airport codes and scheduled times. |
| Show live progress | status, departure.actual, arrival.estimated |
Distinguish the latest reported progress from the original schedule. |
| Help a traveler navigate | departure.terminal, departure.gate, arrival.terminal, arrival.gate |
Display location details when present, and refresh them as live information changes. |
The schedule response structure places records in data.schedules. The real-time example places a flight in data.flight. Keep those structures separate in your integration rather than assuming that a schedule record contains every live tracking field.
Read Fiji Airways schedule records
First, obtain an API key and prepare an authenticated schedule request using the documented parameters. Confirm whether the endpoint’s iataCode value should identify an airline or an airport for your request; then check the returned airline.iata on each record before presenting it as a Fiji Airways flight.
The following Python example takes the complete, authenticated schedule URL as its argument. It calls that URL, reads data.schedules and prints the fields needed for a basic FJ schedule display. Supply the URL according to the authentication and parameter instructions for your account; treat it as a secret if it contains your API key.
import json
import sys
from urllib.error import HTTPError, URLError
from urllib.request import urlopen
if len(sys.argv) != 2:
raise SystemExit("Provide an authenticated schedule URL as the argument.")
url = sys.argv[1]
schedule_endpoint = "https://api.goflightlabs.com/flights-schedules?"
if not url.startswith(schedule_endpoint):
raise SystemExit("Provide a FlightLabs schedule URL.")
try:
with urlopen(url, timeout=30) as response:
payload = json.load(response)
except (HTTPError, URLError, TimeoutError, ValueError) as exc:
raise SystemExit(f"Could not read the schedule response: {exc}")
if payload.get("success") is not True:
raise SystemExit("FlightLabs did not report a successful response.")
data = payload.get("data") or {}
schedules = data.get("schedules") or []
for schedule in schedules:
airline = schedule.get("airline") or {}
if airline.get("iata") != "FJ":
continue
departure = schedule.get("departure") or {}
arrival = schedule.get("arrival") or {}
print(
schedule.get("flight_number") or "Flight number unavailable",
departure.get("airport") or "Departure unavailable",
departure.get("scheduled") or "Departure time unavailable",
departure.get("terminal") or "Departure terminal unavailable",
"->",
arrival.get("airport") or "Arrival unavailable",
arrival.get("scheduled") or "Arrival time unavailable",
arrival.get("terminal") or "Arrival terminal unavailable",
)
Run the script with the prepared URL as its argument. In production, avoid exposing a key in shell history, process listings or application logs; use the authentication method and secret-management approach appropriate to your deployment.
The code checks success before reading data.schedules and treats absent fields as unavailable rather than filling them with guesses. It also filters on airline.iata, so an airport-oriented schedule request can be narrowed to records returned as FJ. An empty result should be shown as no matching records in the retrieved response, not as proof that Fiji Airways has no flights.
The schedule example also includes aircraft.type and aircraft.registration. Those can be useful supplementary details when returned, but a flight status page can work without them. Do not make an aircraft value a prerequisite for displaying a schedule.
Turn the fields into useful FJ features
Flight status pages
Use the returned flight_number, departure and arrival airport codes, and scheduled times to build a Fiji Airways journey card. Label the times as scheduled, and display terminal information only where it is available. An absent terminal or gate should read “not available,” not appear as an empty confirmed location.
When a corresponding live record is available, use its status, departure.actual and arrival.estimated to add progress information. Keep the scheduled and updated times visibly distinct. A traveler should be able to tell whether a time is planned, estimated or recorded as actual without interpreting a color or icon.
Flight identifiers can also involve codeshares. A record attributed to FJ is useful for an airline-filtered view, but the provided schedule fields do not establish the operating carrier or a codeshare relationship. Avoid labeling FJ as the operator solely because airline.iata is FJ; use documented codeshare information when available.
Delay monitoring
For a live FJ record, compare departure.actual with departure.scheduled after departure, or arrival.estimated with arrival.scheduled when an arrival estimate is available. Calculate differences only after parsing both timestamps as instants. Present the result as a calculated difference, not as an independently reported delay field.
An estimate can move in either direction, and a missing actual time is not automatically a delay. Retain the scheduled value alongside the latest estimate, record when your application last refreshed the data, and avoid calculating a delay when either required timestamp is absent. For historical analysis, define whether you are measuring actual departure differences or estimated arrival differences; they are not interchangeable.
Route analysis
Group returned FJ schedule records by departure.airport and arrival.airport to understand which airport pairs appear in the retrieved data. Preserve the flight identifier and scheduled time with each observation so that individual records remain inspectable.
Describe the result as coverage of the schedules you retrieved, not a definitive Fiji Airways route network. The result depends on the request scope, available records and pagination. A route absent from one response may simply be outside that response’s scope.
Handle time, updates and incomplete results
The supplied response examples use ISO 8601 timestamps ending in Z, indicating UTC. Parse the offset rather than treating the timestamp as a local clock reading. Store an unambiguous instant and convert it to the relevant airport or user time zone for display; include the time-zone designation so travelers can interpret it correctly.
Use an airport’s documented time-zone information when it is available, rather than inferring a zone from the airline or a fixed offset. Local dates can differ between departure and arrival, and daylight-saving rules can affect conversion. Keep the original scheduled and updated timestamps available for audit and recalculation.
For live tracking, choose a polling interval based on how quickly the display needs to change and the limits of your FlightLabs account. Cache the latest successful result and share it among viewers of the same flight instead of making a separate request for every page load. A display should show when its data was last refreshed and distinguish cached information from a current update.
If a refresh fails, retain the last successful result only with a clear stale-data indication; do not silently present it as live. Schedules generally need less frequent refreshes than an active tracking view, but they can still change. Set cache lifetimes according to the purpose of the screen and revisit them as you observe the application’s behavior.
Treat cancellation and diversion as operational states, not ordinary delays. If returned status information indicates a cancellation, do not imply that the flight is merely late. If a flight is diverted, avoid presenting the originally scheduled arrival as a confirmed actual destination; show the available status and clearly label any original schedule details. When the response does not contain enough detail, say so rather than inventing a replacement destination or time.
For schedule retrieval, check the endpoint documentation for the applicable pagination controls and response behavior. Process all relevant pages before calculating route counts or declaring a result complete. Store enough progress information to retry a failed retrieval without silently skipping records, and handle repeated records defensively when combining pages.
FAQ
How do I identify Fiji Airways records?
Check the returned airline.iata field for FJ. Confirm the scope and supported values of the schedule request separately; filtering returned records does not change what the request retrieves.
Is a scheduled arrival the same as an estimated arrival?
No. arrival.scheduled is the planned time, while arrival.estimated is an updated estimate when provided in a live record. Display their labels explicitly and do not treat an estimate as an actual arrival.
How often should I refresh a live flight?
Choose a frequency that suits the display and your account limits. Cache shared results, expose the last refresh time and show a stale-data warning if updates fail.
Can I determine codeshares from the schedule fields shown here?
The fields shown here identify an airline on a schedule record but do not establish a codeshare relationship or operating carrier. Consult the relevant endpoint documentation before adding those labels.
Ready to build an FJ schedule view? Register for a FlightLabs API key, or explore the MCP if it fits your integration workflow.