I have a simple class called Thing
public class Thing {
private int id
private String name
}
I would like to send a request with a payload and process it.
The query will look something like this:
curl -i -d '{"thing": {"id": 11, "name": "foobar"}}' http://localhost:8080/thing/{username}
But I can't figure out how to handle a json request. This is what my method looks like:
@Path("/thing/{username}")
@POST
public Thing add(@PathParam("username") String username) {
}
source
share