Class 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
    • Constructor Detail

      • OpenSkyApi

        public OpenSkyApi()
        Create an instance of the API for anonymous access.
      • OpenSkyApi

        public OpenSkyApi​(String username,
                          String password)
        Create an instance of the API for authenticated access
        Parameters:
        username - an OpenSky username
        password - an OpenSky password for the given username
    • 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. If null, 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. If null, no filter will be applied on the ICAO24 address.
        bbox - bounding box to retrieve data for a certain area. If null, 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. If null, 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. If null, 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