NinjaOne to JSM Assets

NinjaOne to JSM Assets

NinjaOne to JSM Assets Integration Guide

This guide explains how to use OnLink to import NinjaOne device data into JSM Assets. It covers the NinjaOne API connection, request configuration, pagination, sample data, field mapping, validation, and optional filters.

Overview

OnLink can import NinjaOne API responses into JSM Assets object types by using mapping statements such as key:, map:, and config:. Use this approach for supported NinjaOne object types, provided the relevant NinjaOne API endpoint and Assets object type are configured.

The high-level process is:

  1. Create or confirm the target JSM Assets schema and object type.

  2. Create a NinjaOne API client and capture the Client ID and Client Secret.

  3. Configure an OnLink NinjaOne connection that uses OAuth client credentials.

  4. Set the API method, endpoint, and pagination options.

  5. Fetch sample data and map NinjaOne JSON fields to JSM Assets attributes.

  6. Use Get Data to validate the result, then run the import.

1. Configure NinjaOne credentials

  1. In NinjaOne, go to Administration > Apps > API and add a client app.

  2. Choose API Services (machine-to-machine).

  3. Set the scope to Monitoring and the grant type to Client Credentials.

  4. Copy the Client ID and Client Secret. The secret is shown only once.

  5. In OnLink, create a new NinjaOne connection and use the API link to parse the connection details.

  6. Select OAuth client credentials.

  7. Set Token URL to https://app.ninjarmm.com/ws/oauth/token.

  8. Enter the Client ID and Client Secret.

The read-only Monitoring scope is sufficient for OnLink to import device data. For more information, see the NinjaOne authorization documentation: https://app.ninjarmm.com/apidocs-beta/authorization/flows/client-credentials-flow

2. Configure the API request

Use a GET request to retrieve devices from the NinjaOne API.

  1. Set Method to GET.

  2. Set URL to the NinjaOne devices endpoint. The API reference is available here: https://app.ninjarmm.com/apidocs-beta/core-resources/operations/getDevices

  3. Leave Response data path empty.

  4. Keep the remaining settings at their defaults unless the endpoint requires query parameters.

GET https://app.ninjarmm.com/v2/devices

3. Configure pagination

The NinjaOne API supports pagination. Configure the pagination settings in OnLink as shown below.

4. Fetch sample data

Save the connection, then run it to fetch sample values from NinjaOne. Use the returned sample JSON to confirm that the endpoint is correct and to identify the field names needed for mapping.

Sample response

{ "hosts": [ { "created_at": "2020-11-05T05:09:44Z", "updated_at": "2020-11-05T06:03:39Z", "id": 1, "detail_updated_at": "2020-11-05T05:09:45Z", "last_restarted_at": "2020-11-01T03:01:45Z", "software_updated_at": "2020-11-05T05:09:44Z", "label_updated_at": "2020-11-05T05:14:51Z", "policy_updated_at": "2023-06-26T18:33:15Z", "last_enrolled_at": "2023-02-26T22:33:12Z", "seen_time": "2020-11-05T06:03:39Z", "hostname": "Annas-MacBook-Pro.local", "uuid": "392547dc-0000-0000-a87a-d701ff75bc65", "platform": "darwin", "osquery_version": "5.15.0", "os_version": "macOS 15.2", "build": "24C101", "platform_like": "darwin", "code_name": "", "uptime": 8305000000000, "memory": 2084032512, "cpu_type": "arm64e", "cpu_subtype": "ARM64E", "cpu_brand": "Apple M1", "cpu_physical_cores": 8, "cpu_logical_cores": 8, "hardware_vendor": "Apple Inc.", "hardware_model": "MacBookPro17,1", "hardware_version": "", "hardware_serial": "C0124FXASD6G", "computer_name": "Anna's MacBook Pro", "timezone": null, "display_name": "Anna's MacBook Pro", "public_ip": "123.45.678.910", "primary_ip": "192.12.345.678", "primary_mac": "36:34:a5:6b:7b:5c", "distributed_interval": 10, "config_tls_refresh": 10, "logger_tls_period": 8, "status": "offline", "display_text": "Annas-MacBook-Pro.local", "team_id": null, "fleet_id": null, "team_name": null, "fleet_name": null, "gigs_disk_space_available": 174.98, "percent_disk_space_available": 71, "gigs_total_disk_space": 246, "additional": {}, "pack_stats": [ { "pack_id": 0, "pack_name": "Global", "type": "global", "query_stats": [ { "scheduled_query_name": "Get recently added or removed USB drives", "scheduled_query_id": 5535, "query_name": "Get recently added or removed USB drives", "discard_data": false, "last_fetched": null, "automations_enabled": false, "description": "Returns a record every time a USB device is plugged in or removed", "pack_name": "Global", "average_memory": 434176, "denylisted": false, "executions": 2, "interval": 86400, "last_executed": "2023-11-28T00:02:07Z", "output_size": 891, "system_time": 10, "user_time": 6, "wall_time": 0 } ] } ], "issues": { "failing_policies_count": 1, "critical_vulnerabilities_count": 2, "total_issues_count": 3 }, "geolocation": { "country_iso": "US", "city_name": "New York", "geometry": { "type": "point", "coordinates": [40.6799, -74.0028] } }, "mdm": { "encryption_key_available": false, "enrollment_status": "Pending", "dep_profile_error": true, "name": "NinjaOne", "server_url": "https://example.ninjaone.com/mdm/apple/mdm", "device_status": "unlocked", "pending_action": "" }, "software": [ { "id": 1, "name": "glibc", "version": "2.12", "source": "rpm_packages", "generated_cpe": "cpe:2.3:a:gnu:glibc:2.12:*:*:*:*:*:*:*", "last_opened_at": "2021-08-18T21:14:00Z", "vulnerabilities": [ { "cve": "CVE-2009-5155", "details_link": "https://nvd.nist.gov/vuln/detail/CVE-2009-5155", "cvss_score": 7.5, "epss_probability": 0.01537, "cisa_known_exploit": false, "cve_published": "2022-01-01T12:32:00Z", "cve_description": "In the GNU C Library (aka glibc or libc6) before 2.28, parse_reg_exp in posix/regcomp.c misparses alternatives, which allows attackers to cause a denial of service (assertion failure and application exit) or trigger an incorrect result by attempting a regular-expression match.", "resolved_in_version": "2.28" } ], "installed_paths": ["/usr/lib/some-path-1"] } ], "policies": [ { "id": 1, "name": "Gatekeeper enabled", "query": "SELECT 1 FROM gatekeeper WHERE assessments_enabled = 1;", "description": "Checks if gatekeeper is enabled on macOS devices", "resolution": "Fix with these steps...", "platform": "darwin", "response": "fail", "fleet_maintained": true, "critical": false } ], "users": [ { "uid": 0, "username": "root", "type": "", "groupname": "root", "shell": "/bin/bash" }, { "uid": 1, "username": "bin", "type": "", "groupname": "bin", "shell": "/sbin/nologin" } ], "labels": [ { "created_at": "2021-08-19T02:02:17Z", "updated_at": "2021-08-19T02:02:17Z", "id": 6, "name": "All Hosts", "description": "All hosts that have enrolled in NinjaOne", "query": "SELECT 1;", "platform": "", "label_type": "builtin", "label_membership_type": "dynamic" }, { "created_at": "2021-08-19T02:02:17Z", "updated_at": "2021-08-19T02:02:17Z", "id": 9, "name": "CentOS Linux", "description": "All CentOS hosts", "query": "SELECT 1 FROM os_version WHERE platform = 'centos' OR name LIKE '%centos%'", "platform": "", "label_type": "builtin", "label_membership_type": "dynamic" }, { "created_at": "2021-08-19T02:02:17Z", "updated_at": "2021-08-19T02:02:17Z", "id": 12, "name": "All Linux", "description": "All Linux distributions", "query": "SELECT 1 FROM osquery_info WHERE build_platform LIKE '%ubuntu%' OR build_distro LIKE '%centos%';", "platform": "", "label_type": "builtin", "label_membership_type": "dynamic" } ] } ] }

5. Configure the Assets import and mapping

After the connection is established, create the Assets import by following the JSM Assets Data Synchronization guide.

Use the fetched API sample to identify the NinjaOne JSON field names and map them to the corresponding JSM Assets attributes. The key: mapping should use a stable unique value that OnLink can use to match and update existing Assets objects.

Mapping

Description

Mapping

Description

key:id=Device ID

Uses the NinjaOne device id field from the getDevices response as the unique key for matching and updating JSM Assets objects.

map:hostname=Hostname

Maps the NinjaOne device hostname field to Hostname. This stores the hostname returned for the device by the getDevices API.

map:uuid=UUID

Maps the NinjaOne device uuid field to UUID. This captures the device UUID from the getDevices response for additional identification.

map:platform=Platform

Maps the NinjaOne device platform field to Platform. This records the operating system or platform reported for the device.

map:hardware_model=Hardware Model

Maps the NinjaOne device hardware_model field to Hardware Model. This stores the hardware model returned for the device.

map:display_name=Display Name

Maps the NinjaOne device display_name field to Display Name. This stores the human-readable device name shown in NinjaOne.

map:primary_ip=Primary IP

Maps the NinjaOne device primary_ip field to Primary IP. This captures the primary IP address reported for the device.

The mapping table lists only example fields. You can map any field returned in the response data, as long as the corresponding Assets attribute exists.

Mapping guidance

  • Start with one unique key: mapping so OnLink can identify whether to create or update an Assets object.

  • Add map: entries for each NinjaOne field you want to store in Assets.

  • Compare the NinjaOne sample JSON with the Assets object type attributes before running an import.

  • If a value is nested in the JSON response, inspect the sample output carefully and use the field path supported by the OnLink mapping configuration.

6. Validate and run the import

  1. Use Get Data to preview the data returned by NinjaOne.

  2. Confirm that the sample records contain the expected fields and values.

  3. Review object type mappings and attribute names for spelling and case consistency.

  4. Run the import only after the previewed data and mapping are correct.

7. Optional filtering

Use NinjaOne API query parameters to limit the records returned by the endpoint. For supported filters, refer to the NinjaOne API documentation for the endpoint you are using.

For supported filters, see the NinjaOne device filters documentation: https://app.ninjarmm.com/apidocs-beta/core-resources/articles/devices/device-filters

For example, to return only approved devices, add the following query parameter:

df=status = APPROVED