记录:
POST http://192.168.225.34:8084/getProfile?emp_pf_no=2323 http / 1.1 400 Bad Request http://192.168.225.34:8084/getProfile?emp_pf_no=2323(1067ms)
这是我的API界面:
@POST("getProfile")
Call<GetProfileResponse> getProfile(@Query("emp_pf_no") String emp_pf_no);
我从服务器获得响应时收到错误。它正在使用Postman post方法调用但不能在Android中工作
private void fetchComplain(String emp_no) {
Call<GetProfileResponse> call = RestClient.get().getProfile(emp_no);
Dialogutils.showProgressDialog(this);
call.enqueue(new Callback<GetProfileResponse>() {
@Override
public void onResponse(Call<GetProfileResponse> call, Response<GetProfileResponse> response) {
Dialogutils.hideProgressDialog(ProfileActivity.this);
GetProfileResponse res = response.body();
if(response.isSuccessful()){
if(res.getStatus()== Constants.SUCCESS){
data.clear();
data.addAll(res.getData());
Toast.makeText(ProfileActivity.this, "Response:"+res.getData(), Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(ProfileActivity.this,"Error"+res.getMessage(),Toast.LENGTH_SHORT).show();
}
}else {
Toast.makeText(ProfileActivity.this,"Error Occured Try Again1",Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<GetProfileResponse> call, Throwable t) {
Dialogutils.hideProgressDialog(ProfileActivity.this);
Toast.makeText(ProfileActivity.this,"Error Occured Try Again",Toast.LENGTH_SHORT).show();
}
});
}
邮递员回应:
{
"message": "PROFILE VIEW SUCCESSFULLY DONE",
"status": 1,
"data": [
{
"emp_id": "1",
"emp_pf_no": "2323",
"emp_name": "user",
"emp_designation": "dev",
"emp_bu_no": "1234.0",
"emp_bill_unit_name": "123my",
"emp_date_of_birth": "12-Dec-2018",
"emp_date_of_appointment": "05-Aug-1996",
"emp_date_of_retirement": "02-Aug-2015",
"emp_aadhaar_number": "545433533333",
"emp_pan_number": "3543544343",
"emp_community": "jain",
"emp_religion": "hindu",
"emp_sex": "female",
"emp_mobile_no": "9.479657692E9",
"emp_phone_no": "7.4122653E8",
"emp_residential_address": "karmdi road",
"emp_parmanent_address": "karmdi road",
"failReason": null
}
]
}