android volley post request with body -
i have api post method when pass parameters in body using post man working fine in android using volley tried this
stringrequest makecomment = new stringrequest(request.method.post, url, respond, errorrespond) { @override public byte[] getbody() throws authfailureerror { hashmap<string, string> params2 = new hashmap<string, string>(); params2.put("fullname", "s"); params2.put("content", "s"); params2.put("post_id", "149603"); return new jsonobject(params2).tostring().getbytes(); } @override public string getbodycontenttype() { return "application/json"; } };
and tried
@override protected map<string,string> getparams(){ map<string,string> params = new hashmap<string, string>(); params.put("fullname", "s"); params.put("content", "s"); params.put("post_id", "149603"); return params; }
but not work show 404 error in log ,
com.android.volley.servererror
Comments
Post a Comment