JSS 9.65 returning JSON default instead of XML - broken Patchoo!

loceee
Contributor

Anyone else seeing this? It's happened before apparently...

https://jamfnation.jamfsoftware.com/discussion.html?id=7673

Since upgrading our (windows) JSS to 9.65, data returned from the api is in json rather than XML.

That breaks patchoo and some of my other scripts that interact with the API. Pushing fixes up soon if you are using them

1 ACCEPTED SOLUTION

loceee
Contributor
5 REPLIES 5

mm2270
Legendary Contributor III

Yep, its not just since 9.65 though. We saw it when we upgraded our 8.x environment to 9.61, though I don't know how far back the problem existed. I had to change all of my API scripts to force xml output instead of JSON to make them work again.
I'm not certain if this issue is universal, as in, everyone using Casper Suite 9.6x would see it, or only when the JSS is hosted on certain platform(s) We run on a virtualized Windows Server environment and see it. Not sure about those on Mac or Linux servers.

chriscollins
Valued Contributor

As far as I remember it has to deal with certain versions of Java on certain platforms that makes the webapp default to json instead of xml. For instance I see it on my Linux JSS in the DMZ but not my Windows JSS inside our network.

tlarkin
Honored Contributor

@loceee

I have only ever seen this happen in specific environments like my post you linked stated. It sure is a strange one. When I encountered the problem originally I could only reproduce it on RHEL and CentOS boxes. Debian based Linux did not have that issue with Open JDK/JRE and Oracle JDK/JRE as well. On top of that it was specific versions of Java and the Redhat based Linux distro. I think I tried it on a BSD box too (it was a couple years ago hard to remember all the details) and it worked as expected there.

I have personally not seen this happen in Windows Server or OS X Server, but I suspect if it can happen in one platform it could happen in another. In your scenario did you also update Java recently, or simply just the JSS? I would suggest we open a support ticket to investigate why this is happening. I can test it out on my end as well.

I spun up a test cloud instance and curl'd down computer ID 1 and the results returned to me in XML by default. Of course a cloud hosted JSS is not the same platform as your on premise Windows environment. I would still open a ticket so we can investigate this further. I have seen this in the past and it is typically environment specific. Hopefully we can determine what the issue is.

As a work around you can force the header response in curl commands to only accept XML formats. If you were coding this for Patchoo it may be a good idea to investigate that method as well, since you could never know what a user's environment is when using Patchoo. Also, keep up the good work, digging your stuff man!

Thanks,
Tom

loceee
Contributor

Thanks, I will open a ticket! I only updated the JSS to 9.65, Windows 2012R2 - Java 7 -update 75

Agreed, I am updating all my scripts that interact with the API to force xml, to be sure to be sure to be sure.

Will push some commits to github soon(ish).

loceee
Contributor

Pushed a fix if you have the issue with patchoo or asucatalogset.sh.

https://github.com/patchoo/patchoo/commit/b88276673c17c6cd628cc455a5595286d573d6e6