### Install OpenSky Java API using Maven
Source: https://openskynetwork.github.io/opensky-api/java
Instructions to install the OpenSky Java API locally using Maven. This involves running a clean install command and adding the necessary dependency to your project's pom.xml file.
```bash
mvn clean install
```
```xml
org.opensky
opensky-api
1.3.0
```
--------------------------------
### GET /getStates
Source: https://openskynetwork.github.io/opensky-api/javadoc/org/opensky/model/class-use/OpenSkyStates
Retrieve state vectors for a given time. This endpoint is used to fetch general flight data for a specified time and optional filters.
```APIDOC
## GET /getStates
### Description
Retrieve state vectors for a given time.
### Method
GET
### Endpoint
/getStates
### Parameters
#### Query Parameters
- **time** (int) - Required - The timestamp for which to retrieve state vectors.
- **icao24** (String[]) - Optional - An array of ICAO24 addresses to filter the results.
- **bbox** (OpenSkyApi.BoundingBox) - Optional - A bounding box to filter results within a geographical area.
### Request Example
```json
{
"example": "(No request body for GET request)"
}
```
### Response
#### Success Response (200)
- **OpenSkyStates** (object) - Contains the retrieved state vectors.
#### Response Example
```json
{
"example": "(Example response structure for OpenSkyStates would go here)"
}
```
```
--------------------------------
### Get Flights by Aircraft (Shell)
Source: https://openskynetwork.github.io/opensky-api/rest
This example demonstrates how to retrieve all flights for a specific aircraft within a given time interval using the `curl` command. The `icao24` parameter specifies the aircraft's unique identifier, and `begin` and `end` define the time window in Unix time. The output is piped to `python -m json.tool` for pretty-printing the JSON response. This endpoint is limited to data from the previous day or earlier.
```shell
$ curl -u "USERNAME:PASSWORD" -s "https://opensky-network.org/api/flights/aircraft?icao24=3c675a&begin=1517184000&end=1517270400" | python -m json.tool
```
--------------------------------
### GET /getMyStates
Source: https://openskynetwork.github.io/opensky-api/javadoc/org/opensky/model/class-use/OpenSkyStates
Retrieve state vectors for your own sensors. This endpoint allows users to fetch specific flight data associated with their registered sensors.
```APIDOC
## GET /getMyStates
### Description
Retrieve state vectors for your own sensors.
### Method
GET
### Endpoint
/getMyStates
### Parameters
#### Query Parameters
- **time** (int) - Required - The timestamp for which to retrieve state vectors.
- **icao24** (String[]) - Optional - An array of ICAO24 addresses to filter the results.
- **serials** (Integer[]) - Optional - An array of serial numbers to filter the results.
### Request Example
```json
{
"example": "(No request body for GET request)"
}
```
### Response
#### Success Response (200)
- **OpenSkyStates** (object) - Contains the retrieved state vectors.
#### Response Example
```json
{
"example": "(Example response structure for OpenSkyStates would go here)"
}
```
```
--------------------------------
### Get Arrivals by Airport
Source: https://openskynetwork.github.io/opensky-api/python
Retrieves flights that arrived at a specific airport within a given time interval.
```APIDOC
## Get Arrivals by Airport
### Description
Retrieves flights for a certain airport which arrived within a given time interval.
### Method
`get_arrivals_by_airport`
### Endpoint
Not directly an HTTP endpoint, this is a client method.
### Parameters
#### Path Parameters
* None
#### Query Parameters
* None
#### Request Body
* **airport** (str) - Required. ICAO identifier for the airport.
* **begin** (int) - Required. Start of time interval as Unix time (seconds since epoch).
* **end** (int) - Required. End of time interval as Unix time (seconds since epoch).
### Request Example
```python
from opensky_api import OpenSkyApi
api = OpenSkyApi("your_username", "your_password")
flights = api.get_arrivals_by_airport("EDDF", 1609459200, 1609545600)
if flights:
for flight in flights:
print(flight)
```
### Response
#### Success Response (200)
* Returns a list of `FlightData` objects if the request was successful.
#### Response Example
```json
[
{
"icao24": "a0b1c2",
"callsign": "DLH123",
"origin_country": "Germany",
"time_position": 1609545000,
"last_contact": 1609545500,
"longitude": 8.5709,
"latitude": 50.0379,
"barometer_altitude": 10000,
"velocity": 250,
"true_track": 270,
"vertical_rate": 0,
"sensors": 5,
"geo_altitude": 10000,
"position_update": 1609545100,
"last_position_update": 1609545500
}
]
```
```
--------------------------------
### Get My States
Source: https://openskynetwork.github.io/opensky-api/python
Retrieves state vectors for your own sensors. Authentication is required.
```APIDOC
## Get My States
### Description
Retrieve state vectors for your own sensors. Authentication is required for this operation. If `time_secs` is 0, the most recent states are retrieved. Optional filters can be applied for ICAO24 addresses and sensor serial numbers.
### Method
`get_my_states`
### Endpoint
Not directly an HTTP endpoint, this is a client method.
### Parameters
#### Path Parameters
* None
#### Query Parameters
* None
#### Request Body
* **time_secs** (int) - Optional. Time as Unix timestamp (seconds since epoch) or datetime object (must be in UTC). Defaults to 0 (most recent).
* **icao24** (str or list[str]) - Optional. Filter by ICAO24 address(es).
* **serials** (int or list[int]) - Optional. Filter by sensor serial number(s).
### Request Example
```python
from opensky_api import OpenSkyApi
api = OpenSkyApi("your_username", "your_password")
# Get most recent states
states = api.get_my_states()
# Get states at a specific time
from datetime import datetime
states_at_time = api.get_my_states(time_secs=int(datetime.utcnow().timestamp()))
# Filter by icao24
states_icao24 = api.get_my_states(icao24="a0b1c2")
# Filter by serial
states_serial = api.get_my_states(serials=12345)
if states:
print(states)
```
### Response
#### Success Response (200)
* Returns an `OpenSkyStates` object if the request was successful.
#### Response Example
```json
{
"time": 1609545600,
"states": [
[
"a0b1c2",
"DLH123",
1609545600,
10,
20,
30,
40,
50,
60,
70,
80,
90,
100,
101
]
]
}
```
```
--------------------------------
### Get Flights from Interval
Source: https://openskynetwork.github.io/opensky-api/python
Retrieves all flight data within a specified time interval.
```APIDOC
## Get Flights from Interval
### Description
Retrieves data of flights for a certain time interval.
### Method
`get_flights_from_interval`
### Endpoint
Not directly an HTTP endpoint, this is a client method.
### Parameters
#### Path Parameters
* None
#### Query Parameters
* None
#### Request Body
* **begin** (int) - Required. Start of time interval as Unix time (seconds since epoch).
* **end** (int) - Required. End of time interval as Unix time (seconds since epoch).
### Request Example
```python
from opensky_api import OpenSkyApi
api = OpenSkyApi("your_username", "your_password")
flights = api.get_flights_from_interval(1609459200, 1609545600)
if flights:
for flight in flights:
print(flight)
```
### Response
#### Success Response (200)
* Returns a list of `FlightData` objects if the request was successful.
#### Response Example
```json
[
{
"icao24": "a0b1c2",
"callsign": "DLH123",
"origin_country": "Germany",
"time_position": 1609500000,
"last_contact": 1609545500,
"longitude": 8.0,
"latitude": 50.0,
"barometer_altitude": 10000,
"velocity": 250,
"true_track": 180,
"vertical_rate": 0,
"sensors": 5,
"geo_altitude": 10000,
"position_update": 1609500100,
"last_position_update": 1609545500
}
]
```
```
--------------------------------
### Get Arrivals by Airport (Shell)
Source: https://openskynetwork.github.io/opensky-api/rest
This command retrieves all flights that arrived at a specific airport within a defined time range. The `airport` parameter uses the ICAO identifier, and `begin` and `end` specify the time interval in Unix time. The results are formatted as a JSON array. Data is limited to the previous day or earlier due to batch updates.
```shell
$ curl -u "USERNAME:PASSWORD" -s "https://opensky-network.org/api/flights/arrival?airport=EDDF&begin=1517227200&end=1517230800" | python -m json.tool
```
--------------------------------
### GET /flights/all
Source: https://openskynetwork.github.io/opensky-api/rest
Retrieves flights within a specified time interval. The interval must not exceed two hours.
```APIDOC
## GET /flights/all
### Description
Retrieves flights within a specified time interval. The interval must not exceed two hours. If no flights are found, an HTTP 404 status is returned.
### Method
GET
### Endpoint
/flights/all
#### Query Parameters
- **begin** (integer) - Required - Start of time interval as Unix time (seconds since epoch).
- **end** (integer) - Required - End of time interval as Unix time (seconds since epoch).
### Request Example
```bash
curl -u "USERNAME:PASSWORD" -s "https://opensky-network.org/api/flights/all?begin=1517227200&end=1517230800" | python -m json.tool
```
### Response
#### Success Response (200)
- The response is a JSON array of flights. Each flight is an object with properties such as:
- **callsign** (string)
- **number** (string)
- **origin_country** (string)
- **time_position** (integer)
- **last_contact** (integer)
- **longitude** (float)
- **latitude** (float)
- **altitude** (float)
- **on_ground** (boolean)
- **velocity** (float)
- **true_track** (float)
- **vertical_rate** (float)
- **sensosrs** (array of integers)
- **geo_altitude** (float)
- **squawk** (string)
- **spi** (boolean)
- **position_source** (integer)
#### Response Example
```json
[
{
"callsign": "EZY123",
"number": "EZY123",
"origin_country": "Spain",
"time_position": 1517230799,
"last_contact": 1517230799,
"longitude": 2.17,
"latitude": 41.39,
"altitude": 10000.0,
"on_ground": false,
"velocity": 220.0,
"true_track": 180.0,
"vertical_rate": 10.0,
"sensors": [1, 2, 3],
"geo_altitude": 10050.0,
"squawk": "7345",
"spi": false,
"position_source": 0
}
]
```
```
--------------------------------
### Retrieve State Vectors by Time - Java
Source: https://openskynetwork.github.io/opensky-api/javadoc/org/opensky/model/class-use/OpenSkyStates
This Java method fetches state vectors for a specified time using the OpenSky API. It takes a timestamp and an array of ICAO24 addresses as input. The result is an OpenSkyStates object containing the flight data for the given time and aircraft.
```java
OpenSkyStates OpenSkyApi.getStates(int time, String[] icao24)
```
--------------------------------
### GET /states/all
Source: https://openskynetwork.github.io/opensky-api/rest
Retrieves state vectors for all aircraft or filtered by time, ICAO24 address, or geographical bounding box. Rate limits apply.
```APIDOC
## GET /states/all
### Description
Retrieves state vectors for all aircraft. This endpoint is rate-limited.
### Method
GET
### Endpoint
https://opensky-network.org/api/states/all
### Parameters
#### Query Parameters
- **time** (integer) - Optional - The time in seconds since epoch (Unix time stamp) to retrieve states for. Current time will be used if omitted.
- **icao24** (string) - Optional - One or more ICAO24 transponder addresses represented by a hex string (e.g. abc9f3). To filter multiple ICAO24 append the property once for each address. If omitted, the state vectors of all aircraft are returned.
- **lamin** (float) - Optional - Lower bound for the latitude in decimal degrees (used with lomin, lamax, lomax to define a bounding box).
- **lomin** (float) - Optional - Lower bound for the longitude in decimal degrees (used with lamin, lamax, lomax to define a bounding box).
- **lamax** (float) - Optional - Upper bound for the latitude in decimal degrees (used with lamin, lomin, lomax to define a bounding box).
- **lomax** (float) - Optional - Upper bound for the longitude in decimal degrees (used with lamin, lomin, lamax to define a bounding box).
- **extended** (integer) - Optional - Set to 1 if extended information is required.
### Request Example
```
https://opensky-network.org/api/states/all?time=1458564121&icao24=3c6444
https://opensky-network.org/api/states/all?lamin=45.8389&lomin=5.9962&lamax=47.8229&lomax=10.5226
```
### Response
#### Success Response (200)
- **states** (array) - An array of state vectors. Each state vector is an array containing:
- **0**: icao24 (string)
- **1**: callsign (string)
- **2**: time_position (integer)
- **3**: last_contact (integer)
- **4**: longitude (float)
- **5**: latitude (float)
- **6**: baro_altitude (float)
- **7**: on_ground (boolean)
- **8**: velocity (float)
- **9**: true_track (float)
- **10**: vertical_rate (float)
- **11**: sensors (array of integers)
- **12**: geo_altitude (float)
- **13**: squawk (string)
- **14**: spi (boolean)
- **15**: position_source (integer)
- **16**: category (integer, optional, if extended=1)
#### Response Example
```json
{
"states": [
[
"a00001",
"CSH102 ",
1458564121,
1458564119,
8.9056,
47.4986,
11430.0,
false,
246.6,
113.5,
0.0,
[0, 1, 2, 3, 4, 5, 6],
11277.9,
null,
false,
0
]
]
}
```
```
--------------------------------
### Retrieve States for Specific Aircraft - cURL
Source: https://openskynetwork.github.io/opensky-api/rest
This example shows how to retrieve state vectors for specific aircraft identified by their ICAO24 addresses. Multiple ICAO24 addresses can be provided by appending the `icao24` parameter for each address. The command uses cURL to fetch the data and `python -m json.tool` to format the JSON output for easier reading.
```shell
$ curl -s "https://opensky-network.org/api/states/all?icao24=3c6444&icao24=3e1bf9" | python -m json.tool
```
--------------------------------
### Get States
Source: https://openskynetwork.github.io/opensky-api/python
Retrieves state vectors for a given time. Optionally filters by ICAO24 addresses or bounding box.
```APIDOC
## Get States
### Description
Retrieve state vectors for a given time. If `time_secs` is 0, the most recent states are retrieved. Optional filters can be applied for ICAO24 addresses and bounding box.
### Method
`get_states`
### Endpoint
Not directly an HTTP endpoint, this is a client method.
### Parameters
#### Path Parameters
* None
#### Query Parameters
* None
#### Request Body
* **time_secs** (int) - Optional. Time as Unix timestamp (seconds since epoch) or datetime object (must be in UTC). Defaults to 0 (most recent).
* **icao24** (str or list[str]) - Optional. Filter by ICAO24 address(es).
* **bbox** (tuple) - Optional. Filter by bounding box `[min_latitude, max_latitude, min_longitude, max_longitude]` in WGS84 decimal degrees.
### Request Example
```python
from opensky_api import OpenSkyApi
api = OpenSkyApi()
# Get most recent states
states = api.get_states()
# Get states at a specific time
from datetime import datetime
states_at_time = api.get_states(time_secs=int(datetime.utcnow().timestamp()))
# Filter by icao24
states_icao24 = api.get_states(icao24="a0b1c2")
# Filter by bounding box
bounding_box = (40.0, 50.0, -10.0, 0.0) # (min_lat, max_lat, min_lon, max_lon)
states_bbox = api.get_states(bbox=bounding_box)
if states:
print(states)
```
### Response
#### Success Response (200)
* Returns an `OpenSkyStates` object if the request was successful.
#### Response Example
```json
{
"time": 1609545600,
"states": [
[
"a0b1c2",
"DLH123",
1609545600,
10,
20,
30,
40,
50,
60,
70,
80,
90,
100,
101
]
]
}
```
```
--------------------------------
### Get Flights by Aircraft
Source: https://openskynetwork.github.io/opensky-api/python
Retrieves flight data for a specific aircraft within a given time interval.
```APIDOC
## Get Flights by Aircraft
### Description
Retrieves data of flights for a certain aircraft and time interval.
### Method
`get_flights_by_aircraft`
### Endpoint
Not directly an HTTP endpoint, this is a client method.
### Parameters
#### Path Parameters
* None
#### Query Parameters
* None
#### Request Body
* **icao24** (str) - Required. Unique ICAO 24-bit address of the transponder in hex string format (all lowercase).
* **begin** (int) - Required. Start of time interval as Unix time (seconds since epoch).
* **end** (int) - Required. End of time interval as Unix time (seconds since epoch).
### Request Example
```python
from opensky_api import OpenSkyApi
api = OpenSkyApi("your_username", "your_password")
flights = api.get_flights_by_aircraft("a0b1c2", 1609459200, 1609545600)
if flights:
for flight in flights:
print(flight)
```
### Response
#### Success Response (200)
* Returns a list of `FlightData` objects if the request was successful.
#### Response Example
```json
[
{
"icao24": "a0b1c2",
"callsign": "DLH123",
"origin_country": "Germany",
"time_position": 1609500000,
"last_contact": 1609545500,
"longitude": 8.0,
"latitude": 50.0,
"barometer_altitude": 10000,
"velocity": 250,
"true_track": 180,
"vertical_rate": 0,
"sensors": 5,
"geo_altitude": 10000,
"position_update": 1609500100,
"last_position_update": 1609545500
}
]
```
```
--------------------------------
### GET /tracks
Source: https://openskynetwork.github.io/opensky-api/rest
Retrieves the trajectory (a list of waypoints) for a given aircraft (icao24) at a specified time. If time is 0, it attempts to retrieve the live track.
```APIDOC
## GET /tracks
### Description
Retrieves the trajectory for a specific aircraft at a given time. The trajectory is a list of waypoints containing position, barometric altitude, true track and an on-ground flag.
### Method
GET
### Endpoint
`/tracks/all`
### Parameters
#### Query Parameters
- **icao24** (string) - Required - Unique ICAO 24-bit address of the transponder in hex string representation. All letters need to be lower case.
- **time** (integer) - Required - Unix time in seconds since epoch. It can be any time between the start and end of a known flight. If time = 0, get the live track if there is any flight ongoing for the given aircraft.
### Request Example
```json
{
"example": "$ curl -u \"USERNAME:PASSWORD\" -s \"https://opensky-network.org/api/tracks/all?icao24=3c4b26&time=0\""
}
```
### Response
#### Success Response (200)
- **icao24** (string) - Unique ICAO 24-bit address of the transponder in lower case hex string representation.
- **startTime** (integer) - Time of the first waypoint in seconds since epoch (Unix time).
- **endTime** (integer) - Time of the last waypoint in seconds since epoch (Unix time).
- **callsign** (string) - Callsign (8 characters) that holds for the whole track. Can be null.
- **path** (array) - Waypoints of the trajectory.
- **time** (integer) - Time which the given waypoint is associated with in seconds since epoch (Unix time).
- **latitude** (float) - WGS-84 latitude in decimal degrees. Can be null.
- **longitude** (float) - WGS-84 longitude in decimal degrees. Can be null.
- **baro_altitude** (float) - Barometric altitude in meters. Can be null.
- **true_track** (float) - True track in decimal degrees clockwise from north (north=0°). Can be null.
- **on_ground** (boolean) - Boolean value which indicates if the position was retrieved from a surface position report.
#### Response Example
```json
{
"example": {
"icao24": "3c4b26",
"startTime": 1600000000,
"endTime": 1600003600,
"callsign": "D-ABYF",
"path": [
[1600000000, 48.5, 9.0, 3000.0, 180.0, false],
[1600000900, 48.6, 9.1, 3200.0, 185.0, false],
[1600003600, 49.0, 9.5, 3500.0, 190.0, false]
]
}
}
```
### Limitations
It is not possible to access flight tracks from more than 30 days in the past.
```
--------------------------------
### Retrieve State Vectors by Time and Bounding Box - Java
Source: https://openskynetwork.github.io/opensky-api/javadoc/org/opensky/model/class-use/OpenSkyStates
This Java method retrieves state vectors for a specific time and geographical bounding box using the OpenSky API. It requires a timestamp, an array of ICAO24 addresses, and an OpenSkyApi.BoundingBox object. The output is an OpenSkyStates object.
```java
OpenSkyStates OpenSkyApi.getStates(int time, String[] icao24, OpenSkyApi.BoundingBox bbox)
```
--------------------------------
### OpenSky API - Get States
Source: https://openskynetwork.github.io/opensky-api/javadoc/index-all
Retrieves state vectors for a given time. This endpoint allows fetching flight data for a specific timestamp.
```APIDOC
## GET /api/states
### Description
Retrieve state vectors for a given time.
### Method
GET
### Endpoint
/api/states
### Parameters
#### Query Parameters
- **time** (int) - Required - The timestamp for which to retrieve state vectors.
- **icao24[]** (String[]) - Optional - An array of icao24 identifiers to filter the results.
### Request Example
```
GET /api/states?time=1407183600&icao24[]=a0b0c1&icao24[]=d0e0f1
```
### Response
#### Success Response (200)
- **states** (OpenSkyStates) - An object containing the state vectors for the specified time.
```
--------------------------------
### Retrieve All States (Authenticated) - cURL
Source: https://openskynetwork.github.io/opensky-api/rest
This example demonstrates how to retrieve all flight states from the OpenSky API using basic HTTP authentication. Replace USERNAME and PASSWORD with your actual OpenSky API credentials. The output is piped to `json.tool` for readability. This method is suitable for accessing data with user-specific permissions or quotas.
```shell
$ curl -u "USERNAME:PASSWORD" -s "https://opensky-network.org/api/states/all" | python -m json.tool
```
--------------------------------
### OpenSky API - Get Own States
Source: https://openskynetwork.github.io/opensky-api/javadoc/index-all
Retrieves state vectors for your own sensors. This endpoint is for accessing data from specific sensor configurations.
```APIDOC
## GET /api/ अपनी_states
### Description
Retrieve state vectors for your own sensors.
### Method
GET
### Endpoint
/api/ अपनी_states
### Parameters
#### Query Parameters
- **time** (int) - Required - The timestamp for which to retrieve state vectors.
- **icao24[]** (String[]) - Optional - An array of icao24 identifiers to filter the results.
- **serial[]** (Integer[]) - Optional - An array of serial numbers to filter the results.
### Request Example
```
GET /api/ अपनी_states?time=1407183600&icao24[]=a0b0c1&serial[]=12345
```
### Response
#### Success Response (200)
- **states** (OpenSkyStates) - An object containing the state vectors for your own sensors.
```
--------------------------------
### GET /states/own - Retrieve Own State Vectors
Source: https://openskynetwork.github.io/opensky-api/rest
Retrieves state vectors for your own sensors without rate limitations. Authentication is required.
```APIDOC
## GET /states/own
### Description
Retrieves state vectors for your own sensors. This endpoint does not have rate limitations. Authentication is required; otherwise, a 403 Forbidden error will be returned.
### Method
GET
### Endpoint
`/api/states/own`
### Parameters
#### Query Parameters
- **time** (integer) - Optional - The time in seconds since epoch (Unix timestamp) to retrieve states for. If omitted, the current time will be used.
- **icao24** (string) - Optional - One or more ICAO24 transponder addresses represented by a hex string (e.g. abc9f3). To filter multiple ICAO24 addresses, append the property once for each address. If omitted, the state vectors of all aircraft are returned.
- **serials** (integer) - Optional - Retrieve only states of a subset of your receivers. This argument can be passed multiple times to filter for more than one receiver. The API returns all states of aircraft visible to at least one of the given receivers.
### Request Example
```bash
# Retrieve states for your own sensors at the current time
curl -u "USERNAME:PASSWORD" -s "https://opensky-network.org/api/states/own" | python -m json.tool
# Retrieve states for a specific time and ICAO24 address
curl -u "USERNAME:PASSWORD" -s "https://opensky-network.org/api/states/own?time=1678886400&icao24=a1b2c3" | python -m json.tool
```
### Response
#### Success Response (200)
- **states** (array) - An array of state vectors for your own sensors. The structure of each state vector is similar to the `/states/all` endpoint.
#### Response Example
```json
{
"time" : 1678886400,
"states" : [
// ... array of state vectors ...
]
}
```
```
--------------------------------
### Get Departures by Airport (Shell)
Source: https://openskynetwork.github.io/opensky-api/rest
This shell command fetches all flights that departed from a specified airport within a given time interval. The `airport` parameter is the ICAO identifier, and `begin` and `end` define the time window in Unix time. The response is a JSON array. The time interval must not exceed two days.
```shell
$ curl -u "USERNAME:PASSWORD" -s "https://opensky-network.org/api/flights/departure?airport=EDDF&begin=1517227200&end=1517230800" | python -m json.tool
```
--------------------------------
### Retrieve All States (Anonymous) - cURL
Source: https://openskynetwork.github.io/opensky-api/rest
This example shows how to retrieve all available flight states from the OpenSky API as an anonymous user. It uses cURL to make the request and pipes the output to `json.tool` for pretty-printing the JSON response. No special authentication or parameters are needed.
```shell
$ curl -s "https://opensky-network.org/api/states/all" | python -m json.tool
```
--------------------------------
### Deserialize OpenSkyStates - Java
Source: https://openskynetwork.github.io/opensky-api/javadoc/org/opensky/model/class-use/OpenSkyStates
This Java method is responsible for deserializing OpenSkyStates objects, likely from a JSON response, using Jackson library. It takes a JsonParser and DeserializationContext as input and returns a deserialized OpenSkyStates object.
```java
OpenSkyStates OpenSkyStatesDeserializer.deserialize(com.fasterxml.jackson.core.JsonParser jp, com.fasterxml.jackson.databind.DeserializationContext dc)
```
--------------------------------
### Retrieve Own Sensor State Vectors - Java
Source: https://openskynetwork.github.io/opensky-api/javadoc/org/opensky/model/class-use/OpenSkyStates
This Java method retrieves state vectors for your own sensors using the OpenSky API. It requires a timestamp, an array of ICAO24 addresses, and an array of serial numbers as input. The output is an OpenSkyStates object containing the requested data.
```java
OpenSkyStates OpenSkyApi.getMyStates(int time, String[] icao24, Integer[] serials)
```
--------------------------------
### OpenSkyApi Initialization
Source: https://openskynetwork.github.io/opensky-api/python
Initializes the OpenSky API client. Authentication is optional, but recommended for full access.
```APIDOC
## OpenSkyApi Initialization
### Description
Initializes an instance of the API client. If username and password are not provided, requests will be anonymous, which may impose limitations.
### Method
`__init__`
### Parameters
#### Path Parameters
* None
#### Query Parameters
* None
#### Request Body
* **username** (str) - Optional. An OpenSky username.
* **password** (str) - Optional. An OpenSky password for the given username.
### Request Example
```python
from opensky_api import OpenSkyApi
# Anonymous access
api = OpenSkyApi()
# Authenticated access
api = OpenSkyApi("your_username", "your_password")
```
### Response
* N/A (Constructor does not return data directly)
### Response Example
* N/A
```
--------------------------------
### OpenSkyStates Constructor and Methods
Source: https://openskynetwork.github.io/opensky-api/javadoc/org/opensky/model/OpenSkyStates
This section details the constructor and core methods for the OpenSkyStates class, which encapsulates flight state data.
```APIDOC
## OpenSkyStates
### Description
Represents states of vehicles at a given time.
### Method
- `OpenSkyStates()`
- `getStates()`
- `getTime()`
- `setStates(Collection states)`
- `setTime(int time)`
### Parameters
#### Constructor
- `OpenSkyStates()`: Initializes a new instance of the OpenSkyStates class.
#### Getters
- `getStates()`: Returns the collection of `StateVector` objects representing the actual states for this point in time.
- `getTime()`: Returns the point in time (as an integer) for which states are stored.
#### Setters
- `setStates(Collection states)`: Sets the collection of `StateVector` objects for this point in time.
- `setTime(int time)`: Sets the point in time for which states are stored.
### Request Example
```json
{
"example": "N/A"
}
```
### Response
#### Success Response (200)
- `Collection`: A collection of state vectors for a given time.
- `int`: The timestamp for the states.
#### Response Example
```json
{
"example": "N/A"
}
```
```
--------------------------------
### OpenSkyStates Constructor - Java
Source: https://openskynetwork.github.io/opensky-api/javadoc/org/opensky/model/OpenSkyStates
Initializes a new instance of the OpenSkyStates class. This constructor does not take any arguments and is used to create an empty state object.
```java
public OpenSkyStates()
```
--------------------------------
### Get Track by Aircraft
Source: https://openskynetwork.github.io/opensky-api/python
Retrieves the trajectory for a specific aircraft at a given time. This endpoint is experimental.
```APIDOC
## Get Track by Aircraft
### Description
Retrieve the trajectory for a certain aircraft at a given time. **Note: The tracks endpoint is purely experimental.**
### Method
`get_track_by_aircraft`
### Endpoint
Not directly an HTTP endpoint, this is a client method.
### Parameters
#### Path Parameters
* None
#### Query Parameters
* None
#### Request Body
* **icao24** (str) - Required. Unique ICAO 24-bit address of the transponder in hex string format (all lowercase).
* **t** (int) - Optional. Time as Unix time (seconds since epoch). Defaults to 0 (most recent).
### Request Example
```python
from opensky_api import OpenSkyApi
api = OpenSkyApi("your_username", "your_password")
trajectory = api.get_track_by_aircraft("a0b1c2", t=1609545600)
if trajectory:
print(trajectory)
```
### Response
#### Success Response (200)
* Returns flight track data if the request was successful. The exact format may vary as it's experimental.
#### Response Example
```json
[
{
"callsign": "DLH123",
"airport": {
"origin": "EDDF",
"destination": "KJFK"
},
"time": {
"firstSeen": 1609459200,
"lastSeen": 1609545600
},
"path": [
{
"time": 1609459200,
"latitude": 50.0,
"longitude": 8.0,
"altitude": 10000,
"on_ground": false
},
{
"time": 1609459800,
"latitude": 50.1,
"longitude": 8.1,
"altitude": 10500,
"on_ground": false
}
]
}
]
```
```
--------------------------------
### Get Departures by Airport
Source: https://openskynetwork.github.io/opensky-api/python
Retrieves flights that departed from a specific airport within a given time interval.
```APIDOC
## Get Departures by Airport
### Description
Retrieves flights for a certain airport which departed within a given time interval.
### Method
`get_departures_by_airport`
### Endpoint
Not directly an HTTP endpoint, this is a client method.
### Parameters
#### Path Parameters
* None
#### Query Parameters
* None
#### Request Body
* **airport** (str) - Required. ICAO identifier for the airport.
* **begin** (int) - Required. Start of time interval as Unix time (seconds since epoch).
* **end** (int) - Required. End of time interval as Unix time (seconds since epoch).
### Request Example
```python
from opensky_api import OpenSkyApi
api = OpenSkyApi("your_username", "your_password")
flights = api.get_departures_by_airport("EDDF", 1609459200, 1609545600)
if flights:
for flight in flights:
print(flight)
```
### Response
#### Success Response (200)
* Returns a list of `FlightData` objects if the request was successful.
#### Response Example
```json
[
{
"icao24": "a0b1c2",
"callsign": "DLH123",
"origin_country": "Germany",
"time_position": 1609459800,
"last_contact": 1609460000,
"longitude": 8.5709,
"latitude": 50.0379,
"barometer_altitude": 10000,
"velocity": 250,
"true_track": 90,
"vertical_rate": 0,
"sensors": 5,
"geo_altitude": 10000,
"position_update": 1609459900,
"last_position_update": 1609460000
}
]
```
```
--------------------------------
### GET /api/states/own
Source: https://openskynetwork.github.io/opensky-api/rest
Retrieves state vectors for your own sensors. You can optionally filter by specific sensor serial numbers.
```APIDOC
## GET /api/states/own
### Description
Retrieves state vectors for your own sensors. You can optionally filter by specific sensor serial numbers.
### Method
GET
### Endpoint
/api/states/own
#### Query Parameters
- **serials** (integer) - Optional - Serial number of the receiver to retrieve states from. Can be specified multiple times.
### Request Example
```bash
curl -u "USERNAME:PASSWORD" -s "https://opensky-network.org/api/states/own?serials=123456" | python -m json.tool
```
### Response
#### Success Response (200)
- **_time_** (integer) - The time which the state vectors in this response are associated with.
- **_states_** (array) - The state vectors. Each element is a two-dimensional array containing detailed aircraft state information.
#### Response Example
```json
{
"time": 1678886400,
"states": [
[
"a00001",
"BAW286",
"DE",
1678886390,
1678886400,
8.55,
47.38,
11000.0,
false,
240.0,
120.0,
0.0,
null,
null,
0
]
]
}
```
```
--------------------------------
### API Credit Usage Information
Source: https://openskynetwork.github.io/opensky-api/rest
Information on how API credits are calculated for different endpoints, including states/all, flights, and tracks. Credit usage for states/all is based on area size, while for flights and tracks, it's based on query partitions (number of days).
```APIDOC
## API Credit Usage
API credits are used for all endpoints except `/states/own`. Credit usage is generally lower for restricted areas and shorter time frames.
### `/states/all` Credit Calculation
Credit usage for `/states/all` is calculated by square degrees. The area can be restricted using `lamin`, `lamax`, `lomin`, and `lomax` query parameters.
| Area square deg | Credits | Example |
|-----------------|---------|-----------------------------------------------------------------------|
| 0 - 25 (<500x500km) | 1 | `/api/states/all?lamin=49.7&lamax=50.5&lomin=3.2&lomax=4.6` |
| 25 - 100 (<1000x1000km)| 2 | `/api/states/all?lamin=46.5&lamax=49.9&lomin=-1.4&lomax=6.8` |
| 100 - 400 (<2000x2000km)| 3 | `/api/states/all?lamin=42.2&lamax=49.8&lomin=-4.7&lomax=10.9` |
| over 400 (>2000x2000km)| 4 | `/api/states/all` |
### `/flights` and `/tracks` Credit Calculation
For `/flights` and `/tracks`, credit usage is calculated by the partitions used by the query, which roughly corresponds to the number of days queried.
```
--------------------------------
### Arrivals by Airport
Source: https://openskynetwork.github.io/opensky-api/rest
Retrieves flights that arrived at a specific airport within a given time interval. Note that only arrivals from the previous day or earlier are available.
```APIDOC
## GET /flights/arrival
### Description
Retrieve flights for a certain airport which arrived within a given time interval [begin, end]. If no flights are found for the given period, HTTP stats 404 - Not found is returned with an empty response body.
### Method
GET
### Endpoint
/flights/arrival
### Parameters
#### Query Parameters
- **airport** (string) - Required - ICAO identifier for the airport.
- **begin** (integer) - Required - Start of time interval to retrieve flights for as Unix time (seconds since epoch).
- **end** (integer) - Required - End of time interval to retrieve flights for as Unix time (seconds since epoch).
The given time interval must not be larger than two days!
### Response
#### Success Response (200)
The response is a JSON array of flights where each flight is an object with the following properties.
#### Response Example
```json
[
{
"estDepartureAirport": null,
"lastSeen": null,
"estArrivalAirport": null,
"ident": null,
"number": null,
"airborne": null,
"longitude": null,
"latitude": null,
"created": null,
"deleted": null,
"aes9000": null,
"groundspeed": null,
"icao24": "a0b1c2",
"sensorinfo": null,
"callsign": null,
"timestamp": null,
"arrival": null,
"departure": null,
"onGround": null,
"lastContact": null,
"vertical_rate": null,
"altitude": null
}
]
```
### Example Request
```bash
$ curl -u "USERNAME:PASSWORD" -s "https://opensky-network.org/api/flights/arrival?airport=EDDF&begin=1517227200&end=1517230800" | python -m json.tool
```
```