我需要使用改型插入性别和地址,但是当我尝试调用api插入数据时,这给了我我的类字段不能为空的错误。
代码实现:
List<ClaimBindingModel> al = new ArrayList<>();
ClaimBindingModel cbmGender = new ClaimBindingModel();
cbmGender.setType("Gender");
cbmGender.setValue(radioButton.getText().toString());
ClaimBindingModel cbmAddress = new ClaimBindingModel("Address", Objects.requireNonNull(tiedtAddress.getText()).toString());
al.add(cbmGender);
al.add(cbmAddress);
改造:
@Headers({ "Content-Type: application/json;charset=UTF-8"})
@PUT("/api/accounts/user/{id}/assignclaims")
Call<ResponseBody> assignClaimsToUser(
@Path("id") String id,
@Body List<ClaimBindingModel> claimsToAssign);
它给了我这个错误
fail : error The request is invalid.
fail : error_description {"claimsToAssign[1].Value":["The Claim Value field is required."],"claimsToAssign[1].Type":["The Claim Type field is required."],"claimsToAssign[0].Type":["The Claim Type field is required."],"claimsToAssign[0].Value":["The Claim Value field is required."]}