Android Volley删除带有参数的请求

时间:2018-07-24 08:17:35

标签: request android-volley sql-delete

我正在呼叫此网址以删除请求

https://sommurl/bookings/{booking_id}

我正在使用截击来删除请求,例如

public void delete() {
    //RequestQueue initialized
    JSONObject params = new JSONObject();
    mRequestQueue = Volley.newRequestQueue(this);
    //String Request initialized
    mStringRequest = new StringRequest(Request.Method.DELETE, "https://sommurl/bookings/{M4RCQWPQLJ}", new Response.Listener<String>() {
        @Override
        public void onResponse(String response) {
            Log.e("TAG","Response is :" + response.toString());


        }
    },new Response.ErrorListener() {

        @Override
        public void onErrorResponse(VolleyError error) {
            Log.e("TAG", "Registration Error: " + error.getMessage());
            Toast.makeText(getApplicationContext(),
                    error.getMessage(), Toast.LENGTH_LONG).show();

        }
    }) {

        @Override
        public Map<String, String> getHeaders() throws AuthFailureError {
            Map<String,String> params = new HashMap<String, String>();
            params.put("Authorization","authkey");
            // params.put("Content-Type", "application/json");
            params.put("Content-Type", "application/json");
            return params;
        }

    };

    mRequestQueue.add(mStringRequest);
}

我在响应中收到错误404 但是在邮递员上,我得到的是我想要的确切结果。 请帮助更正此删除请求

0 个答案:

没有答案