Dean Gibson Dean Gibson - 4 months ago 28
Java Question

REST Webservice returning 415 - Unsupported Media Type

I've created a REST webservice using jax-rs and jersey that is supposed to consume JSON on a POST request. My web service class looks like this:

public class Webhook {

public Response readData (Song song) {

// Prints out the song info
System.out.println("SONG INFO \n=======================");
System.out.println("songname: " + song.getSongname());
System.out.println("artist: " + song.getArtist());

// Repsonse with a HTTP 200 OK
Response response = Response.status(200).build();
return response;



My Song class:

public class Song {

private String songname;
private String artist;

public String getSongname () { return this.songname; }
public String getArtist () { return this.artist; }

public void setSongname (String songname) { this.songname = songname; }
public void setArtist (String artist) { this.artist = artist; }


My web.xml (if needed)

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi=""
id="WebApp_ID" version="3.0">




I'm using RESTClient a little, well, rest client... Here's a screenshot of what I'm sending:

enter image description here

When I send that off, I get the 415 Unsupported Media Type error. Anybody have an idea why?


You need to send the request-header Content-Type: application/json. Seems like REST-Client does not add this header automatically for you.