title: Volley Post Request not working to the API
body: <p>I used Volley to POST name, password and email of a user for registration purpose. I took reference from <a href="https://www.simplifiedcoding.net/android-volley-post-request-tutorial/" rel="nofollow">This tutorial</a>. And worked same as defined in this tutorial.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST,
                              URL_string.api_url,null
                              new Response.Listener&lt;JSONObject&gt;() {
                                  @Override
                                  public void onResponse(JSONObject response) {
                                      Log.i("Result", "Success");
                                  }
                              }, new Response.ErrorListener() {
                          @Override
                          public void onErrorResponse(VolleyError error) {
                              Log.i("Result", "UnSuccess");
                          }
                      }){
  
                          @Override
                          protected Map&lt;String, String&gt; getParams() throws AuthFailureError {
                              Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
                              Log.i("Result_Params",emailValue + passwordValue + nameValue);
                              params.put("email", emailValue);
                              params.put("password", passwordValue);
                              params.put("name", nameValue);
                              return super.getParams();
                          }
  
                          @Override
                          public Map&lt;String, String&gt; getHeaders() throws AuthFailureError {
                              HashMap&lt;String, String&gt; headers = new HashMap&lt;String, String&gt;();
                              headers.put("Content-Type", "application/json; charset=utf-8");
                              return super.getHeaders();
                          }
  
                      };
  
                      RequestQueue requestQueue = Volley.newRequestQueue(this);
                      jsonObjectRequest.setRetryPolicy(new DefaultRetryPolicy(DefaultRetryPolicy.DEFAULT_TIMEOUT_MS * 2, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
                      requestQueue.add(jsonObjectRequest);
  </code></pre>
  
  <p>But my code shows this error:</p>
  
  <pre><code>[368] BasicNetwork.performRequest: Unexpected response code 422 for http://myapi.com/api/register
  </code></pre>
  
  <p>Error 422 is defined on the API as:</p>
  
  <pre><code>    {
         "message": "422 Unprocessable Entity",
         "errors": {
           "email": [
             "The email field is required."
           ],
           "password": [
             "The password field is required."
           ],
           "name": [
             "The password field is required."
           ]
         },
         "status_code": 422
  }
  </code></pre>
  
  <p>I tried:</p>
  
  <ol>
  <li><p>changing JsonObjectRequest to StringRequest,</p></li>
  <li><p>the original URL at the place of  URL_string.api_url,</p></li>
  </ol>
  
  <p>But the response is still same. Is this because of I didn't make any class for Volley library? I did that too from <a href="http://www.androidhive.info/2014/05/android-working-with-volley-library-1/" rel="nofollow">Androidhive.info</a>, but failed!</p>
  
  <p>I don't know how to go ahead from this step now, while Log in getParams logs the correct value of name, email, and pw entered by the user, but still POST operation is not working. Please help!
  Thanks in advance!</p>