I am building a RESTful web-service in Java using Jersey 1.11, and have problems implementing a method which consumes a list of JSON-ised entities. The single instance method wo
I think PathParam and also a Param which should unmarshalled by Jersey(JAX-RS) is not possible. Please try to remove the PathParam Parameter.
And if you need the second Parameter so create a new class like this
@XmlRootElement(name = "example")
public class Example {
@XmlElement(name = "param")
private String param;
@XmlElement(name = "entities")
private List entities;
}
and also modify your Methode :
@POST
@Path("/some-path")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public String createBatch(Example example)
{
...
}
your JSON Should look like this:
{
"param":"someParam",
"entities":[
{"field1" : value1, "field2" : value2}, {"field1" : value3, "field2" : value4}, ...]
}