Extracting inventory data via the API

Valued Contributor

I need to develop a method for our Windows based Asset team to automatically retrieve computer inventory data from the JSS (delimited text), for importation into another system.

I'm not a programmer, and I could get one if I have to, but It looks like this might be a fairly simple matter of enabling API access and using the curl command. ?

I've looked at apiFrontPage.rest and apiIntro.rest, but it's not clear to me how I would retrieve full or select Computer inventory data information.

Can anyone share examples of code that would return the following:

Computer Name
IP Address
Last Contact Time
MAC Address
Serial Number

Thanks so much,


Valued Contributor

So I found a Python script in the SDK that does some of what I want, but I get a syntax error running it:

File "./compexport_xml.py", line 153
    except (URLError, HTTPError) as urlError: # Catch errors related to urlopen()
SyntaxError: invalid syntax

Any suggestions from here?

Contributor II

I've dabbled with the api using Ruby with decent success, but to be honest, if you're looking for a big inventory report, the API might not be the best route to take. Basically, with the API you can get a list of all computers, but that list really only contains the Computer name and record ID of each computer, after which you need to loop through each record by ID and build an array to get the list you want. It can be done, but takes a while.

A by-hand approach could probably be done just by searching Inventory and using the "View results as..." popup list at the bottom to export the file to CSV, tab or XML format.

If you do need an automated system and the manual export doesn't do the trick, I'd probably just jump right to the mysql database and do a SQL command to pull the info you need.

Hope that helps.



@fsjeff Have you done the command to pull the mysql data into the SQL database? If so can you share?