尝试使用 RoboSpice 和 Jackson 映射获取响应时出现以下错误,因为返回的错误 JSON 映射不正确
POST request for "https://****/api/register?email=jam@yum.com&first_name=Vege&last_name=Mite&password=qwerty12345&invite_token=oXlTvAvbVR5fiQP6DKCEVQ"
resulted in 422 (Unprocessable Entity); invoking error handler
E//RequestRunner.java:134﹕ 19:01:34.881 Thread-15097 An exception occurred during request network execution :422 Unprocessable Entity
使用 Curl 我得到以下正确响应:
{"object":"Error","errors":{"email":["has already been taken"]}}
我的模型对象失败的休息如下,问题是“错误”项目没有正确映射但我不确定它应该是什么,因为变量名“电子邮件”可以更改(即“代理”、“供应商” “ , ETC..)
@JsonIgnoreProperties(ignoreUnknown = true)
public class BaseModel {
private String id;
private String email;
private String first_name;
private String last_name;
private String street1;
private String street2;
private String city;
private String state;
private String zipcode;
private String country;
private String phone;
private String create_at;
private String object;
private Map<String, ArrayList<String>> errors;
//Getters and Setters Removed