Posted on 05-15-2012 10:07 AM
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?
Posted on 05-16-2012 09:59 AM
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.
Posted on 11-07-2013 07:42 AM
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.
Posted on 11-07-2013 07:55 AM
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:
http://bashscripts.org/forum/viewtopic.php?f=8&t=1330
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.