openskyjs
v1.1.0
Published
OpenSky Network API Client
Downloads
2
Readme
OpenSky-js
This is a Node Promise-based client for the OpenSky Network API.
By using the OpenSky API, you agree with their terms of use.
Installation
$ npm install openskyjs --save
Usage
To see the request parameters that are available, refer to OpenSky's REST API documentation.
import OpenSkyApi from 'openskyjs';
// Prepare client with auth
const openSky = new OpenSkyApi('username', 'pass123');
// Get All States
openSky.getStates()
.then((data) => {
console.log(data.time);
})
.catch((error) => {
console.log(error);
});
// Get States with params
openSky.getStates({ icao24: 'plane123' })
.then((data) => {
const plane = data.states[0];
console.log(data.time);
console.log(plane.longitude, plane.latitude, plane.altitude);
})
.catch((error) => {
console.log(error);
});
// Get Own States (needs auth)
openSky.getOwnStates();