1

I want to make a PATCH request with json object request in android using volley library. Its working in postman but when i call it in android, it gives me error 405,Anybody have any idea How to do it? Below is my code:

requestQueue.add( new JsonObjectRequest(Request.Method.PATCH,url, jsonObject, new Response.Listener<JSONObject>() {
                    @Override
                    public void onResponse(JSONObject response) {

                        GiveCentralUtilities.setCurrentFragment(getActivity(),R.id.fragment_container,
                                SignUpPaymentInfo.newInstance(isSignup),SignUpPaymentInfo.TAG);


                        //  getAccessToken();

                    }
                }, this){
            @Override
            public Map<String, String> getHeaders() throws AuthFailureError {
                Map<String,String> header = new HashMap<String, String>();
                header.put("Authorization","Bearer "+GiveCentralUtilities.getPref(GiveCentralConstants.ACCESSTOKEN,getActivity()));
                header.put("Accept", "application/json");
                //  header.put("Content-Type", "application/json");
                System.out.println("vivekaccess"+GiveCentralUtilities.getPref(GiveCentralConstants.ACCESSTOKEN,getActivity()));

                return header;
            }


            @Override
            public String getBodyContentType() {
                return "application/json";
            }

        });
Mostafiz
  • 7,243
  • 3
  • 28
  • 42

1 Answers1

0

Error 405 means that this error does not come from your JsonObjectRequest. It may be caused by the url, your android phone's network or the server

Mark Shen
  • 346
  • 1
  • 5