title: How to send HTTP POST request in Xamarin?
body: <p>I have a remote address here:
  <a href="http://damp-sands-2243.herokuapp.com/students" rel="nofollow">http://damp-sands-2243.herokuapp.com/students</a></p>
  
  <p>I need to insert new students via API call.</p>
  
  <p>Here is how I did it with javasript:</p>
  
  <pre><code>var data  = {"name":"Meg",
  "regi_number":38};
  
  $(document).ready(function(){
      $.ajax({
              type: "POST",
              url: "/students/",
              contentType: "application/json; charset=utf-8",
              dataType: "json",
              data: JSON.stringify(data),
              success: function(){console.log("boo");}
            });
   });
  </code></pre>
  
  <p>You can go to the URL and use your browser's javascript console in order to check whether it works.</p>
  
  <p>Now, my problem is to do the same thing from Xamarin.
  Here is what I did, </p>
  
  <pre><code>try{
   string data = "{\"name\":\"Meg\",\"regi_number\":38}";
          WebClient client = new WebClient();
          client.Encoding = System.Text.Encoding.UTF8;
          string reply = client.UploadString("https://damp-sands-2243.herokuapp.com/students/", data);
          // Disply the server's response.
          Console.WriteLine(reply);
  }
  
  catch(Exception ex){
         Console.Out.WriteLine("Debug has been started");
         Console.Out.WriteLine(ex.GetType().FullName);
         Console.Out.WriteLine(ex.GetBaseException().ToString());
  }
  </code></pre>
  
  <p>Now I'm getting the following error:</p>
  
  <blockquote>
    <p>05-10 15:48:11.644 I/mono-stdout(32078): Debug has been started
        System.Net.WebException
        05-10 15:48:11.645 I/mono-stdout(32078): System.Net.WebException
        System.Net.WebException: The remote server returned an error: (422)     Unprocessable Entity .
        05-10 15:48:11.658 I/mono-stdout(32078): System.Net.WebException: The remote     server returned an error: (422) Unprocessable Entity .
          at System.Net.HttpWebRequest.CheckFinalStatus (System.Net.WebAsyncResult result) [0x0033b] in :0 
          at System.Net.HttpWebRequest.SetResponseData (System.Net.WebConnectionData data) [0x00165] in :0</p>
  </blockquote>