Skip to main content
Solved

JSS API returning JSON instead of XML


Forum|alt.badge.img+3
  • New Contributor
  • 6 replies

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?

Best answer by tlarkin

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

View original
Did this topic help you find an answer to your question?

3 replies

Forum|alt.badge.img+31
  • Honored Contributor
  • 2721 replies
  • Answer
  • July 2, 2013

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


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • 6 replies
  • July 3, 2013

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.


Forum|alt.badge.img+15
  • Contributor
  • 34 replies
  • October 7, 2013

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

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