我是Dropwizard的新手。我已经为API请求创建了Resource。 API正在与Postman一起使用相同的有效负载但不使用android排球。
UserDTO.java
public class UserDTO {
private String emailId;
private String fcmToken;
private String password;
public String getEmailId() {
return emailId;
}
public void setEmailId(String emailId) {
this.emailId = emailId;
}
public String getFcmToken() {
return fcmToken;
}
public void setFcmToken(String fcmToken) {
this.fcmToken = fcmToken;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
UserResource.java
@Path(URLConstants.USER)
@Produces(MediaType.APPLICATION_JSON)
public class UserResource {
@POST
@UnitOfWork
@Path(URLConstants.CREATE)
public Response createUser(UserDTO userDTO) throws Exception {
// I want UserDTO Object here.
}
}
我试图点击用户/创建API,它适用于POSTMAN,但是当我从Android凌空击中API时,我得到400.