Hi All,
I've successfully pulled information out of our JSS using the API. Now I have a new challenge: setting an extension attribute via the API. Is this even possible?
Hi All,
I've successfully pulled information out of our JSS using the API. Now I have a new challenge: setting an extension attribute via the API. Is this even possible?
Best answer by DerekB
Hi Guys,
I wanted to chime in here and let you know that populating an extension attribute is possible via the API. It is a little bit of a round about way to do this as we do need to use the computer computer record to make this work.
To give you an idea of what you can do is you could populate an XML file to be formatted like the following:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><computer><extension_attributes><attribute><name>'"${ea_name}"'</name><value>'"${ea_value}"'</value></attribute></extension_attributes></computer>
Where we have "${ea_name}" would be the name of Extension Attribute we want to populate the data for and the "${ea_value}" variable would be what we want the value to be for the extension attribute.
If we know the ID of the computer we want to change this attribute for we could use a curl command formatted like the following to fill in this information.
/usr/bin/curl -k -u ${jss_username}:${jss_password} ${jss_url}/JSSResource/computers/id/${id} -T "/tmp/ea.xml" -X PUT
It sounds like you guys have worked with the API some, but we should be able to alter any data we can pull via the API by using a PUT command. We just need to follow the same XML format as the data we want to populate.
Let us know if you have any more questions.
Derek Brost
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.