Skip to main content
Question

API - PUT Extension Attributes

  • September 27, 2012
  • 3 replies
  • 2 views

Forum|alt.badge.img+9

I'd like to be able to write data to a couple of Extension Attributes via the API. It doesn't seem to support those fields. Is that true and if so, how have you done it?

Here is a clip of the XML I'm sending to the JSS for a computer record:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<computer>
<extension_attributes>
<equipment_status>In Service</equipment_status>
</extension_attributes>
</computer>

The field is actually called Equipment Status with the "space". Any suggestions would be great.

3 replies

Forum|alt.badge.img+9
  • Author
  • Contributor
  • 124 replies
  • October 3, 2012

I see now that an inventory report is required to update these fields. Thus an API call to update one EA field isn't really feasible. There is the computer table, but then there is a reports table that references the extension_attribute_values table. Thus the dependence on an inventory report to update the EA's.

Will have to start a feature request.


Forum|alt.badge.img+4
  • New Contributor
  • 3 replies
  • October 29, 2012

Hey Jafuller, Not sure if you ever figured this one out, but I just actually started playing with inserting data into the JSS using the REST API. I was able to insert data into an extension attribute. The syntax is just a little different. I created an extension attribute called "Inventory Status" that I'm intending to use once I'm able to pull some data out of our enterprise asset management tool. Here is my xml file that I'm using to input the data. Worked in my environment on Casper 8.6.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<computer>
<general>
    <name>TestMachine1</name>
</general>
<extension_attributes>
    <attribute>
    <name>Inventory Status</name>
    <value>Retired</value>
    </attribute>
</extension_attributes>
</computer>

Forum|alt.badge.img+5
  • New Contributor
  • 9 replies
  • November 6, 2012

Curl command (using terminal):
curl -k -v -u YourAPIUsername:YourAPIPassword https://jss.some.organisation:8443/JSSResource/computers/name/myComputerName/subset/extensionattributes -T "myXMLFile.xml" -X PUT

myXMLFile.xml (file content):
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<computer>
<extension_attributes> <attribute> <name>UsefulInformationTitle</name> <value>UsefulInformationValue</value> </attribute>
</extension_attributes>
</computer>


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings