Package org.opensky.api
Class OpenSkyApi
java.lang.Object
org.opensky.api.OpenSkyApi
Main class of the OpenSky Network API. Instances retrieve data from OpenSky via HTTP
- Author:
- Markus Fuchs, fuchs@opensky-network.org
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Represents a bounding box of WGS84 coordinates (decimal degrees) that encompasses a certain area. -
Constructor Summary
ConstructorsConstructorDescriptionCreate an instance of the API for anonymous access.OpenSkyApi
(String username, String password) Create an instance of the API for authenticated access -
Method Summary
Modifier and TypeMethodDescriptiongetMyStates
(int time, String[] icao24, Integer[] serials) Retrieve state vectors for your own sensors.Retrieve state vectors for a given time.getStates
(int time, String[] icao24, OpenSkyApi.BoundingBox bbox) Retrieve state vectors for a given time.
-
Constructor Details
-
OpenSkyApi
public OpenSkyApi()Create an instance of the API for anonymous access. -
OpenSkyApi
Create an instance of the API for authenticated access- Parameters:
username
- an OpenSky usernamepassword
- an OpenSky password for the given username
-
-
Method Details
-
getStates
Retrieve state vectors for a given time. If time == 0 the most recent ones are taken. Optional filters might be applied for ICAO24 addresses.- Parameters:
time
- Unix time stamp (seconds since epoch).icao24
- retrieve only state vectors for the given ICAO24 addresses. Ifnull
, no filter will be applied on the ICAO24 address.- Returns:
OpenSkyStates
if request was successful,null
otherwise or if there's no new data/rate limit reached- Throws:
IOException
- if there was an HTTP error
-
getStates
public OpenSkyStates getStates(int time, String[] icao24, OpenSkyApi.BoundingBox bbox) throws IOException Retrieve state vectors for a given time. If time == 0 the most recent ones are taken. Optional filters might be applied for ICAO24 addresses. Furthermore, data can be retrieved for a certain area by using a bounding box.- Parameters:
time
- Unix time stamp (seconds since epoch).icao24
- retrieve only state vectors for the given ICAO24 addresses. Ifnull
, no filter will be applied on the ICAO24 address.bbox
- bounding box to retrieve data for a certain area. Ifnull
, no filter will be applied on the position.- Returns:
OpenSkyStates
if request was successful,null
otherwise or if there's no new data/rate limit reached- Throws:
IOException
- if there was an HTTP error
-
getMyStates
Retrieve state vectors for your own sensors. Authentication is required for this operation. If time = 0 the most recent ones are taken. Optional filters may be applied for ICAO24 addresses and sensor serial numbers.- Parameters:
time
- Unix time stamp (seconds since epoch).icao24
- retrieve only state vectors for the given ICAO24 addresses. Ifnull
, no filter will be applied on the ICAO24 address.serials
- retrieve only states of vehicles as seen by the given sensors. It expects an array of sensor serial numbers which belong to the given account. Ifnull
, no filter will be applied on the sensor.- Returns:
OpenSkyStates
if request was successful,null
otherwise or if there's no new data/rate limit reached- Throws:
IOException
- if there was an HTTP error
-