Package org.opensky.api
Class OpenSkyApi
- java.lang.Object
-
- org.opensky.api.OpenSkyApi
-
public class OpenSkyApi extends Object
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 Classes Modifier and Type Class Description static class
OpenSkyApi.BoundingBox
Represents a bounding box of WGS84 coordinates (decimal degrees) that encompasses a certain area.
-
Constructor Summary
Constructors Constructor Description OpenSkyApi()
Create an instance of the API for anonymous access.OpenSkyApi(String username, String password)
Create an instance of the API for authenticated access
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OpenSkyStates
getMyStates(int time, String[] icao24, Integer[] serials)
Retrieve state vectors for your own sensors.OpenSkyStates
getStates(int time, String[] icao24)
Retrieve state vectors for a given time.OpenSkyStates
getStates(int time, String[] icao24, OpenSkyApi.BoundingBox bbox)
Retrieve state vectors for a given time.
-
-
-
Method Detail
-
getStates
public OpenSkyStates getStates(int time, String[] icao24) 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.- 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
public OpenSkyStates getMyStates(int time, String[] icao24, Integer[] serials) throws IOException
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
-
-