Could someone provide an example of an XML payload for PUT /computers/id/{id} ?

prodservices
New Contributor III

What is the proper format to the xml payload sent to /JSSResource/computers/id/{id}? Do I send only <extension_attribute>? Do I send the entire XML set with just the changes needed?

Here is a representation of a curl call that I'm trying (from Postman):

curl -X PUT 
  'https://Your.Server.Name:8443/JSSResource/computers/id/4?id=4' 
  -H 'Authorization: Basic dGVAFAVADdaVAVaZXM=' 
  -H 'Cache-Control: no-cache' 
  -H 'Content-Type: text/xml' 
  -d '  <extension_attributes>
    <extension_attribute>
      <id>2</id>
      <name>OU</name>
      <type>String</type>
      <value>OUT STRING</value>
    </extension_attribute>
  </extension_attributes>
'

Which produces this:

<p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Bad Request</p> <p>Error in XML file</p>

Many thanks!

3 REPLIES 3

prodservices
New Contributor III

Still no luck but, after referencing this https://www.jamf.com/jamf-nation/discussions/5476/api-put-extension-attributes.

Which now shows...

<p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Conflict</p> <p>Error: Not authorized for a user PUT</p>

ryan_ball
Valued Contributor

You are trying to update the text in an extension attribute for a device?

prodservices
New Contributor III

I'm trying up updated (or add) to extension_attribute in a collections of managed Mac.

And it turns out with a bit more digging, I was able to make some headway.

Assuming the following as a payload, I am able to inject data.

<?xml version="1.0" encoding="UTF-8" standalone="no"?><computer><extension_attributes> <attribute> <name>AD-OU</name> <value>I CAN PUT THE OUT HERE</value> </attribute></extension_attributes></computer>