title: E/Volley: [2342] NetworkUtility.shouldRetryException: Unexpected response code 400
body: <p>I'm using the Android volley library and I'm trying to sending data to the API server but it responds to this error every time</p>
  <pre><code>E/Volley: [2342] NetworkUtility.shouldRetryException: Unexpected response code 400 for API
  </code></pre>
  <p>This is my code:</p>
  <pre><code>       JSONObject params = new JSONObject();
          try {
              params.put(&quot;deptcode&quot;, 649);
              params.put(&quot;endDt&quot;, &quot;2021-07-22T12:37:28.755Z&quot;);
              params.put(&quot;instCode&quot;, 152);
              params.put(&quot;instSesNO&quot;, 0);
              params.put(&quot;locCode&quot;, 2);
              params.put(&quot;observedBy&quot;, obserName);
              params.put(&quot;sessionId&quot;, 0);
              params.put(&quot;startDt&quot;, &quot;2021-07-22T12:37:28.755Z&quot;);
              params.put(&quot;status&quot;, &quot;string&quot;);
          }
          catch (JSONException e) {
              e.printStackTrace();
          }
  
          JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.POST,
                  url, params,
                  new Response.Listener&lt;JSONObject&gt;() {
  
                      @Override
                      public void onResponse(JSONObject response) {
                          Log.d(&quot;TAG&quot;, response.toString());
                      }
                  }, new Response.ErrorListener() {
  
              @Override
              public void onErrorResponse(VolleyError error) {
                  VolleyLog.d(&quot;TAG&quot;, &quot;Error: &quot; + error.getMessage());
              }
          }) {
  
              /**
               * Passing some request headers
               * */
              @Override
              public Map&lt;String, String&gt; getHeaders() throws AuthFailureError {
                  HashMap&lt;String, String&gt; headers = new HashMap&lt;String, String&gt;();
                  headers.put(&quot;Content-Type&quot;, &quot;application/json; charset=utf-8&quot;);
                  return headers;
              }
  
          };
          jsonObjReq.setRetryPolicy(new DefaultRetryPolicy(300000,
                  DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
                  DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
  
          MyRequestQueue.add(jsonObjReq);
  </code></pre>
  <p>I tried many ways but still doesn't work for me. Please help me.</p>