Posted on 07-02-2013 03:29 PM
I'm having problems where the JSS API has switched to returning data in JSON instead of XML. I believe it started happening when we switched to 8.71, but I could be wrong on that. Playing around with curl, I've figured out how to add a header to get it to give me XML, but I'd really like for it to just return XML by default. Anyone else run in to this or have any ideas?
Solved! Go to Solution.
Posted on 07-02-2013 03:59 PM
Hey Alden,
I have seen this happen, but only in particular environments. I saw this a few weeks ago, with Casper 8.7, Redhat 6.3, and both openJDK and Oracle Java version 7. Once we bumped Java down to OpenJDK 6, it returned a default of XML. As you found out, you can force the curl command to change the headers from XML to JSON. I tried replicating the same exact issue on my Ubuntu and Debian virtual test boxes, but using Oracle Java, and OpenJDK versions 6 and 7 worked fine on my Debian based Linux boxes.
I made the assumption this has to do with some change that Redhat did in packaging up the Java libraries. I did not look much further into the issue, since my customer was able to resolve it by changing back to an older version of Java.
What platforms and versions are you using on your JSS?
Thanks,
Tom
Posted on 07-02-2013 03:59 PM
Hey Alden,
I have seen this happen, but only in particular environments. I saw this a few weeks ago, with Casper 8.7, Redhat 6.3, and both openJDK and Oracle Java version 7. Once we bumped Java down to OpenJDK 6, it returned a default of XML. As you found out, you can force the curl command to change the headers from XML to JSON. I tried replicating the same exact issue on my Ubuntu and Debian virtual test boxes, but using Oracle Java, and OpenJDK versions 6 and 7 worked fine on my Debian based Linux boxes.
I made the assumption this has to do with some change that Redhat did in packaging up the Java libraries. I did not look much further into the issue, since my customer was able to resolve it by changing back to an older version of Java.
What platforms and versions are you using on your JSS?
Thanks,
Tom
Posted on 07-03-2013 07:50 AM
Thanks - that did it. I'm running Casper 8.71, CentOS 6.4 and openJDK 6 and 7. openJDK 7 was the default, I changed it to 6, restarted jss and now it's returning xml by default again.
Posted on 10-07-2013 10:26 AM
More simply, you can also just add a subcommand to force XML in your curl command.
/usr/bin/curl -k -u "${jss_user}:${jss_pass}" -H "Accept: application/xml" "${jss_url}/JSSResource/computers" -X GET -o ./computers.xml