https://drive.google.com/file/d/1OiFUCKh1M5Su73SD7Xp8Y_LDqGpyVqC3/view?usp=sharing
I am working with REST api using jersey and I send raw json with postman like this. My code
@POST
@Consumes({MediaType.APPLICATION_JSON})
@Path("register")
public Response register(@QueryParam("email") String email, @QueryParam("username") String userName, @QueryParam("password") String password) {
System.out.println("username: " + userName);
System.out.println("password: " + password);
System.out.println("email: " + email);
}
But I receive
//Output using raw json
username: null,
password: null,
email: null
and I dont know why. If I use Param (the button to the left of Send button in Postman and set key-value) not Raw json. It works
//Output when use param
username: abc,
password: 123456
email: email
Note that: I did set Header with Content-Type: application/json
QueryParambut sending the data as body. You need to either pass the data as part of query parameters or changeregistermethod signature to accept a pojo that will haveusername,passwordandemailfields in it. - tsolakp