0
我使用Slim框架POST API,當我從POSTMAN工具發佈參數到post url時,它的返回響應沒有任何問題,但是當我嘗試從Android發佈參數時,它是給我的錯誤提供完整性約束錯誤的Android POST參數
{錯誤:{文:SQLSTATE [23000]:完整性約束聲音,列不能爲空。
我的Andorid代碼如下:
StringRequest stringRequest = new StringRequest(Request.Method.POST, "URL_TO_POST",
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Toast.makeText(AddFeedbackActivity.this, response, Toast.LENGTH_LONG).show();
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(AddFeedbackActivity.this, error.toString(), Toast.LENGTH_LONG).show();
}
}) {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
params.put("comments", "1");
params.put("fname", "1");
params.put("mobile_no", "1");
return params;
}
};
RequestQueue requestQueue = Volley.newRequestQueue(AddFeedbackActivity.this);
requestQueue.add(stringRequest);
}**