npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jamf

v1.0.2

Published

A Node.js wrapper for the Jamf Pro JSS REST API

Downloads

241

Readme

jamf-sdk-node

NOTE: This package was moved from github.com/mapbox/node-jamf, which has since been archived. The jamf NPM module will be maintained by @trevorspecht, and will no longer have any connection to Mapbox.

A lightweight Node.js wrapper for Jamf Pro's JSS REST API.

Scope

Currently this module only supports GET requests for the JSS REST API. Support for other methods such as PUT, POST, and DELETE will be added later.

Support for the JSS Universal API may also be added later.

Installation

npm install jamf

Usage

The following code sets up the module and configures the API client with values from your local environment:

var JamfApiClient = require('jamf');

var config = {
  user: process.env.JAMF_API_USER,
  password: process.env.JAMF_API_PASSWORD,
  jamfUrl: process.env.JAMF_URL,
  format: 'json'
}

var jamf = new JamfApiClient(config);

jamf.get('/accounts', function (err, res){
  if (err) console.log(err)
  console.log(res)
});

Each Jamf API client method requires a path (e.g. /accounts) and a callback (function(err, res)) function.

For example, if you wanted to get the General and Location subsets of information about a computer with an id of 50:

jamf.get('/computers/id/50/subset/General&Location', function (err, res){
  if (err) console.log(err)
  console.log(res)
});

Examples

You can find more examples in the examples directory of this project.

Configuration

You need to configure the Jamf API client before it can make any API calls. You'll need the following for configuration:

  • user: username for the JSS user accessing the Jamf API
  • password: password for the above account
  • jamfUrl: the URL of your JSS instance, whether on premise or in the cloud (https://yourdomain.jamfcloud.com)
  • format: the format of the returned data, must be either xml (Jamf API default) or json

We recommend you create a new dedicated, least privilege API user for these scripts. The user must have the necessary privileges (create, read, update, or delete) on the JSS objects

Here's an example configuration for obtaining XML data:

var config = {
  user: 'readonlyapiuser',
  password: 'fakepassword',
  jamfUrl: 'https://fakefakefakefake.jamfcloud.com',
  format: 'xml'
}

var jamf = new JamfApiClient(config);

Tests

To run the tests for this project:

npm test

The tests use eslint for linting and tape for tests.

Feature requests and reporting bugs

Are we missing something in this module? Did you find a bug?

Please look through the list of issues (both open and closed) and see if an issue already exists for what you want to propose or report.

Don't see anything in the issues? Please create a new one!

Contributing

Contributors are welcome! If you want to contribute, please fork this repo then submit a pull request (PR).

All of your tests should pass before we'll accept your PR. We also request that you add additional test coverage and documentation updates in your PR where applicable.

Resources

  • You can see all available Jamf API calls by accessing /api on your JSS instance. For example, visit https://yourdomain.jamfcloud.com/api
  • Jamf API Documentation