Skip to main content
Jamf Nation, hosted by Jamf, is a knowledgeable community of Apple-focused admins and Jamf users. Join us in person at the ninth annual Jamf Nation User Conference (JNUC) this November for three days of learning, laughter and IT love.

JSS Rest API not accepting JSON put/post?

I've been doing some work with the API and I'm trying to update the location information of a computer. I can successfully make the appropriate request using XML, but I'm unable to do the same with JSON.

Setting Content-Type to "application/json" results in getting a response with the following message: "Unsupported Media Type,
The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method"

Is the API unable to handle JSON puts/posts or is there something I'm doing wrong?

For reference I'm making the request in objective-c using the ASIHTTPRequest class. here is the JSON I'm sending:

        "general": {"id":265},
        "location":{"room":"IT Room"}
Like Comment
Order by:
SOLVED Posted: by tlarkin

Hi Nicholas,

Yes, the API does in fact support JSON. Depending on your Java libraries on your JSS, it may not want to default to JSON over XML. Like for example, I have seen RHEL servers with Java JRE/JDK 7 by default return JSON every time, but if you downgrade to Java JRE/JDK 6 it defaults back to XML.

The best way to address this, is probably to force the Application type in your curl command. You can use the -H switch in curl to change the return headers to XML or JSON. So for example:

curl -H "Accept: application/json"

This should always return JSON in your GET/PUT/POST from the REST API. Please post back if that does not work, or contact your account manager.


SOLVED Posted: by nicholas.lythall

Hi Tom, thanks for your reply.

I've already been doing exactly what you've suggested and have been receiving json perfectly fine. My problem is only with sending json back to the server. Is there an alternative header to "Content-Type" that I should be setting to let the server know that I'm sending json rather than xml, and is it something other than "application/json"?

SOLVED Posted: by kalik4


Use AFNetworking vs ASIHTTPRequest; it's better for a lot of reasons. Plus, Ben killed it (ASIHTTPRequest) some time ago.

We use AFN classes all the time with JSS for JSON data great with Java 6/7 and JSS 8/9.


SOLVED Posted: by nicholas.lythall

Thanks, I'm looking into AFNetworking.

In an effort to try and eliminate any variables, I'm trying to make the request first through Postman (a chrome app for testing http web service) and I'm still getting 415 unsupported media type errors. Below is a screenshot of all the settings I'm currently using, can anyone spot what I'm missing? Cheers

external image link

SOLVED Posted: by nicholas.lythall

Incase anyone else is looking for an answer, it got onto support and they told me that the API does not support JSON for anything but GET requests. If you want to do put, post, etc you'll have to use XML.

It would have been nice if this was actually documented somewhere. Additionally, the only only reason I was able to construct the xml required for the put/post request is because I can partially remember how to do it from the pre 9.# documentation.

SOLVED Posted: by NightFlight

Booooooooooooooooooooooooooo. I use PHP/JSON because the libraries exist and I'm familiar.

SOLVED Posted: by jpsthecelt

I agree; it's only because most every other web-app and management solution accepts JSON, which is the modern ReST industry 'best-practice'. Other than that.... no reason. BTW, When is the universal API coming? When will it be complete? These are the questions that even management is asking (hence, the increasing popularity of open-source solutions). When folks like Leslie H present at JNUC (, it's exciting, but it'd be nice to be able actually use it. Heck, even BigFix provides this ( ). Sigh....