Curious if anyone has used the API to generate current state XML file for computers in inventory. I want to CURL the output to an XML file and make it available to other systems. However, the issue I run into is WHEN to initiate the XML file creation and HOW to initiate it.
What the end state would be is a directory of unique XML files (using computer name as the file name; so one file per computer) that are consumable by other systems.
I'm thinking that a script to run after initial recon may do it, but would love feedback on that approach.
How would you do it?
Looking at this, I think I could run a command like this:
#!/bin/sh curl -u jssusername:jsspassword "https://jss/JSResource/computers/name/computerName/subset/General&Location&Extension_Attributes" -o filePath;
However, if this is run during Recon what user context is it running in? I'd like the "filePath" to be a network drive and would need to ensure that the permissions are set appropriately.
A relevant question here is what other kinds of systems are going to consume this data and how? 'Cuz I would generally think this information wants to live in a database not as a bunch of formatted flat files.
Forgot that I intended to be helpful. Depending on which computers records you want to export, you may be able to reverse the flow of this script somewhat:
JAFuller's basic idea is right; with curl you can also do globs so if you're looking at anything by IDs in the JSS... so to appropriate his curl from above as an example:
curl -u jssusername:jsspassword "https://jss/JSSResource/computers/id/[1-9]/subset/General&Location&Extension_Attributes" -o filePath#1.xml
This would collect computers with id 1-9... You could likely also create collections to get the just the computers you want organized in such a way that you can serially retrieve them with a much smaller list than everything in your JSS.