Easy to use JavaScript package for fetching data from the Ninja RMM API
Install the ninja-api package with NPM:
npm install ninja-api
You can then use the API by importing the package, creating a client and calling a function:
import { NinjaClient } from "ninja-api";
const { devices } = new NinjaClient({
prefix: "eu",
clientId: "[YOUR_CLIENT_ID]",
clientSecret: "[YOUR_CLIENT_SECRET]",
sessionToken: "[YOUR_SESSION_TOKEN]"
});
devices.get(1).then(device => {
console.log(device)
})
You can use types defined in the API by importing them:
import type { DeviceDetails } from "ninja-api";
const devices: DeviceDetails[] = [];
You can find further documentation about authentication and API routes on the official documentation
This package has no requirements and can be run on any Node.js server or JavaScript client.
The ninja-api script is released under the MIT license.