(Clarification) cURL Update Extensions Attributes

NerdMusk
New Contributor II

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.:

Spoiler

curl -sX PUT "${jssURL}/JSSResource/mobiledevices/id/$jamfDeviceId" -H "accept: application/xml" -H "authorization: Basic ${jssAuth}" -H "Content-Type: application/xml" -d "$putXML"

 Thanks!

1 ACCEPTED SOLUTION

NerdMusk
New Contributor II

Found my answer.  And script is working great now.  Just updated my entire fleet of iPads via my Google Spreadsheet.  :D

View solution in original post

1 REPLY 1

NerdMusk
New Contributor II

Found my answer.  And script is working great now.  Just updated my entire fleet of iPads via my Google Spreadsheet.  :D