Posted on 01-21-2022 01:45 PM
Hey Everybody,
Quick question for you API experts, and apologies in advance. I'm new to this. I'd like to update a specific attribute. I've included some sample XML that's close to what would be grabbed from a specific iPad.
I'd like change "Mrs. Jane Doe" to "Mr. Jon Doe" in "SD-Full Name" of extension attributes.
<?xml version="1.0" encoding="UTF-8"?>
<mobile_device>
<general>
<id>2035</id>
<display_name>School Staff iPad Mr. Jon Doe</display_name>
<device_name>School Staff iPad Mr. Jon Doe</device_name>
<serial_number>B28JDKL1J0CDM</serial_number>
... etc.
</general>
<extension_attributes>
<extension_attribute>
<id>2</id>
<name>SD-Full Name</name>
<type>String</type>
<multi_value>false</multi_value>
<value>Mrs. Jane Doe</value>
</extension_attribute>
<extension_attribute>
<id>3</id>
<name>SD-Notes</name>
<type>String</type>
<multi_value>false</multi_value>
<value/>
</extension_attribute>
<extension_attribute>
<id>1</id>
<name>SD-School</name>
<type>String</type>
<multi_value>false</multi_value>
<value>Top Rated School</value>
</extension_attribute>
</extension_attributes>
</mobile_device>
Do I need to send the extension_attributes and all its children in its entirety, or are the <id> and <value> for a specific child node enough for JAMF to know which node I'm updating?
e.g. Would this be enough (contained in $putXML)
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<mobile_device>
<extension_attributes>
<extension_attribute>
<id>2</id>
<value>Mr. Jon Doe</value>
</extension_attribute>
</extension_attributes>
</mobile_device>
Script e.g.:
curl -sX PUT "${jssURL}/JSSResource/mobiledevices/id/$jamfDeviceId" -H "accept: application/xml" -H "authorization: Basic ${jssAuth}" -H "Content-Type: application/xml" -d "$putXML"
Thanks!
Solved! Go to Solution.
Posted on 01-24-2022 07:09 PM
Found my answer. And script is working great now. Just updated my entire fleet of iPads via my Google Spreadsheet. :D
Posted on 01-24-2022 07:09 PM
Found my answer. And script is working great now. Just updated my entire fleet of iPads via my Google Spreadsheet. :D