So I came across this article https://www.jamf.com/jamf-nation/third-party-products/files/658/jssid-list-to-static-group-using-the-api-script But I was wondering if I can pass along a curl command in a single line with a computers ID to a static group using the Statics Group ID instead of writing out to a tmp xml file. Here is an example of a basic script I'm using to test. For the moment, I'm using a test serial number since I can easily populate my serial numbers into the script.
If this is possible with a simple (rough example to get the point across)
put $JAMF_COMPUTERID to "${apiuser}:${apipass}" "${jssURL}/JSSResource/computergroups/id/${GROUP_ID}"
that would be awesome
#!/bin/bash
#########################################################################################
# Variables - Do Not Modify
#########################################################################################
# API Credentials
#########################################################################################
apiuser="api"
apipass="pass"
jssURL="https://jamf.server.com:8443"
# Serial Number
#########################################################################################
JAMF_SERIAL="###########"
# Pull Computer Asset Tag from JAMF
#########################################################################################
JAMF_STUDENTID=$(curl -H "Accept: text/xml" -sfku "${apiuser}:${apipass}" "${jssURL}/JSSResource/computers/serialnumber/${JAMF_SERIAL}/subset/general" | xmllint --format - 2>/dev/null | awk -F'>|<' '/<asset_tag>/{print $3; exit}')
echo $JAMF_STUDENTID
# Pull Computer ID from JAMF
#########################################################################################
JAMF_COMPUTERID=$(curl -H "Accept: text/xml" -sfku "${apiuser}:${apipass}" "${jssURL}/JSSResource/computers/serialnumber/${JAMF_SERIAL}/subset/general" | xmllint --format - 2>/dev/null | awk -F'>|<' '/<id>/{print $3; exit}')
echo $JAMF_COMPUTERID
# Put Computer ID into JAMF Static Group
#########################################################################################
GROUP_ID="##"
??? put $JAMF_COMPUTERID to "${apiuser}:${apipass}" "${jssURL}/JSSResource/computergroups/id/${GROUP_ID}"