JSS REST API

GarySmith
New Contributor

Hello

I'm working with a company who are moving from an on premise installation of Casper, to a cloud hosted version. Currently they have an integration that connects directly to the database to pull out data which is used in their SAM and ITSM systems. With the cloud version, as the database is not accessible, they are looking to leverage the JSS REST API to pull out the required data. I am working with the company to update this integration.

Currently I'm using the swagger based "JSS REST API Resource Documentation" on the hosted system, and this is the only documentation I have.

In my investigation, it seems that some of the data that the customer is currently pulling out of the database is not exposed via the API. The documentation also does not state what some of the API calls and attributes represent. As such, I have a series of questions, which I hope someone can help me with.

Questions regarding the JAMF Casper API

Which API call should be used to retrieve all available asset hardware details? Currently we are looking at ‘/computerhardwaresoftwarereports’. If this is the correct API call, is it possible to pull back just the last set of data for each computer? I.e. does a date range over the past 90 days cause multiple scan results for a device to be included? Does a date range just for today exclude devices that have not reported in today?

Some of the attributes that are available within the database, do not appear to be accessible via the API (item in brackets is the name within the database), is there some way to retrieve them?:

• Software o Publisher - (‘applications.company’) o Copyright - (‘applications.copyright’) o Registered To – (‘applications.registered_to’)
• Hardware o Domain Name – (‘operating_systems.active_directory’) o Battery – (‘hardware_reportys.battery_capacity’) o IP Address – (‘computers.last_ip’)

Is there a means to determine via the API:
• Software o Publisher name o Product name
• Hardware o If a device is physical or virtual? o If a device is a laptop, desktop, server, mobile or tablet? o When a device was last seen alive? o Number of CPU Core Threads? o Which user last logged onto a device? o Which user is the primary user of the device?

For the API call ‘/computerhardwaresoftwarereports’, what date do the following attributes represent, are they the date the device was last seen, or when the record was last update etc?:
• <date_time>2016/12/30 at 10:33</date_time>
• <date_time_epoch>1483094001053</date_time_epoch>
• <date_time_utc>2016-12-30T10:33:21.053+0000</date_time_utc>

Does the API call ‘/computerhistory/id/{id}/subset/mac_app_store_applications’, specifically the ‘mac_app_store_applications’ return data on applications that have been pushed to a client device? Are all of these applications also in the software inventory API call ‘/computerhardwaresoftwarereports/id/{id}/{startDate}_{endDate}/subset/Software’?

I'd be grateful for any guidance that can be provided.

Many Thanks

Gary

2 REPLIES 2

m_kindelberger
New Contributor II

Hello Gary,

I will try to answer about your API questions:
You can use this Api method : /computers/id/(ID)/subset (Replace (ID) by your JSS Computer ID)
This Subset is linked on your computer view in JSS. It's mean when you perform this request: /computers/id/(ID)/subset/Hardware
You have all information like on Computer hardware section in JSS. This request will return you Battery information for example: <battery_capacity>
If you want General view and Hardware : Use this Uri: /computers/id/(ID)/subset/Hardware&General
You can retrieve ip address for example.

If you use extension attribute this URI can be helpful /computers/id/(ID)/subset/Hardware&General&extensionattributes

Laptop & Desktop: Extension attributes can resolve it: I have script for it: (Not mine but don't remember the owner sorry for him)

#!/usr/bin/ruby

def get_model
  # using awk is way simpler, but i wanted to see if i could use just ruby.
  #model = %x(system_profiler SPHardwareDataType | awk '/Model Identifier:/ {print $NF}')
  # changed to use string.match to make it less ugly. still ugly, though.
  model = %x(system_profiler SPHardwareDataType).match(/Model Identifier: .+$/).to_s.split(":").last.strip
end

def report_model(model)
  if model =~ /(Air|Book)/
    puts "<result>Laptop</result>"
  elsif model =~ /(iMac|MacPro|Mini)/
    puts "<result>Desktop</result>"
  end
end

report_model(get_model)
Number of CPU Core Threads? o Which user last logged onto a device? o Which user is the primary user of the device?

See my previous answer about Computers Api.

For the API call ‘/computerhardwaresoftwarereports’, what date do the following attributes represent, are they the date the device was last seen, or when the record was last update etc?: • <date_time>2016/12/30 at 10:33</date_time> • <date_time_epoch>1483094001053</date_time_epoch> • <date_time_utc>2016-12-30T10:33:21.053+0000</date_time_utc>

It's the date when it detect change. I mean inventory date.

About computerhardwaresoftwarereports or Computers, it's depend which type of information you need to get.

thanks

GarySmith
New Contributor

@m.kindelberger, many thanks for your response, it was very helpful. :-)

For the hardware side, I think I'm about there, but I am struggling with the software. From the database I was pulling the following .APP file based data regarding installed software:

File path: applications.application_path
File name: applications.application_name
File size: applications.size
Copyright: applications.copyright
Vendor: applications.company
Version: applications.application_version
Reg: applications.registered_to

As an alternative to this data, if it is not available, I can try and populate an alternative format that uses:

Application Vendor Name
Application Name
Application Version
Application Description

What is the best API calls to retrieve as much data as possible about installed applications?
/computers/id/{ID}/subset/software, under applications, seems to give me .APP file name, .APP file path, .APP file version. Is there any additional information available for software?

Thanks

Gary
-=-