Posted on 03-20-2012 08:27 AM
I'm using the following to try to extract computer information out to an XML file.
Via Terminal (command wraps in this box): curl –u username:password https://jss.domain.com:8443/JSSResource/computers/name/jafuller674382/subset/General&Location&Extention%20Attributes –o "/Users/jafuller/Desktop/jafuller674382.xml"
I need to get the data from the General tab (works), Location tab (doesn't work) and Extension Attributes (doesn't work).
Can you clarify what syntax would be needed here?
Solved! Go to Solution.
Posted on 03-20-2012 09:40 AM
You have to enclose the curl URL in quotes, otherwise the shell will capture the ampersand.
Below is a snippet from a working script, adapt freely to your environment:
#!/bin/bash
MY_JSS_BASEURL=$( /usr/bin/defaults read /Library/Preferences/com.jamfsoftware.jamf jss_url )
MY_JSS_APIURL="${MY_JSS_BASEURL}JSSResource/"
CURL_OPTIONS="--silent --show-error --connect-timeout 30"
/usr/bin/curl ${CURL_OPTIONS} --output "${MY_TMPFILE}" --request GET --user "${MY_API_USER}":"${MY_API_PASS}"
"${MY_JSS_APIURL}computers/macaddress/${MY_MAC_ADDRESS}/subset/general&location&extension_attributes"
Posted on 03-20-2012 09:40 AM
You have to enclose the curl URL in quotes, otherwise the shell will capture the ampersand.
Below is a snippet from a working script, adapt freely to your environment:
#!/bin/bash
MY_JSS_BASEURL=$( /usr/bin/defaults read /Library/Preferences/com.jamfsoftware.jamf jss_url )
MY_JSS_APIURL="${MY_JSS_BASEURL}JSSResource/"
CURL_OPTIONS="--silent --show-error --connect-timeout 30"
/usr/bin/curl ${CURL_OPTIONS} --output "${MY_TMPFILE}" --request GET --user "${MY_API_USER}":"${MY_API_PASS}"
"${MY_JSS_APIURL}computers/macaddress/${MY_MAC_ADDRESS}/subset/general&location&extension_attributes"