I am having the following server side code:-
import org.json.JSONObject;
@Path("/user")
public class Users {
@POST
@Path("register")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response registerUser(JSONObject userDetails) {
return Response.status(Status.ACCEPTED).entity("User Created.Details are: " + userDetails).build();
}
}
Once I tried to call this using the following I am getting a 415 error. Can you please let me know what is the way to solve this.
{
"user_id": "masha@meeshka.com",
"password": "mashakawa",
"user_profile": {
"name": "Masha",
"city": "New York",
"email": "maasha@kawa.com",
"age": 20
},
"user_settings": {
"phone_number": "+91898342123"
}
}
By the way i am using Jersey.