Created
December 4, 2014 23:29
-
-
Save jhbush/e67055b55ee8dd5f330e to your computer and use it in GitHub Desktop.
csv_import_jamf_api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
apiUser=ladmin | |
apiPass=jamf1234 | |
deptList=/Users/ladmin/Desktop/departments.csv | |
jssURL='https://jssjbush.local:8443' | |
echo $jssURL | |
#:Read variables from departments.csv:# | |
while read inputline;do | |
line0="$(echo $inputline)" | |
echo | |
#:Set auto increment ID:# | |
idAdd0=$((idAdd0 +1)) | |
echo '<?xml version="1.0" encoding="UTF-8"?>'"<department><name>"$line0"</name></department>" >> ~/Desktop/xmldata$idAdd0.xml | |
`curl -k -v -u "$apiUser:$apiPass" "$jssURL/JSSResource/departments/id/XXX" -T ~/Desktop/xmldata$idAdd0.xml -X POST` | |
done < $deptList |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment