I am try to call REST web service from curl, in linux, Also use jersey
then it returns
A message body reader for Java type, class mypackage.UserGroupsData, and MIME media type, application/json, was not found
Mappign class is
public class UserGroupsData {
private int id;
private String name;
public int getId() {
return id;
} public void setId(int id) {
this.id = id;
}public String getName() {
return name;
}public void setName(String name) {
this.name = name;
} public int getId() {
return id;
}}
My POST method id
@POST
@Path("/getQualifiedNumbers")
@Produces("application/json")
@Consumes("application/json")
public Response getQualifiedNumbers(UserGroupsData userGroup){
return Response.status(201).entity(userGroup).build();
}
Curl command which i used to call is
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":"1","name":"e"}' http://localhost:8080/url/getQualifiedNumbers
Server is jetty
Thanks
try to add annotation “@XmlRootElement” in your class. it should become like: