title: Bad Request [400] returned when REST API is called in C#
body: <p>I was using Pushbots to send notifications to my android app and planning to write a method in C# to call the pushbots REST API to broad cast message to all connected phones. As Mentioned <a href="https://pushbots.com/developer/rest" rel="nofollow">Here</a> . But I'm getting a 400 response when request is made.</p>
  
  <p>Here is my C# Class: </p>
  
  <pre><code>    using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Net;
  using System.IO;
  
  namespace RestAPICallTest
  {
      class Program
      {
          static void Main(string[] args)
          {
  
              HttpWebRequest httpWReq =(HttpWebRequest)WebRequest.Create("https://api.pushbots.com/push/all");
  
              Encoding encoding = new UTF8Encoding();
              string postData = "{\"platform\":\"[1]\", \"msg\":\"Hi from Tali\" ,\"badge\":\"10\" ,\"sound\":\"default\"";
              byte[] data = encoding.GetBytes(postData);
  
              httpWReq.ProtocolVersion = HttpVersion.Version11;
              httpWReq.Method = "POST";
              httpWReq.ContentType = "application/json";//charset=UTF-8";
              httpWReq.Headers.Add("X-PUSHBOTS-APPID",
                                                 "52ee4bd11d0ab1282a8b458e");
              httpWReq.Headers.Add("X-PUSHBOTS-SECRET",
                                              "b28825277373379b8c62126b16359d46");
  
              httpWReq.ContentLength = data.Length;
  
  
              Stream stream = httpWReq.GetRequestStream();
              stream.Write(data, 0, data.Length);
              stream.Close();
  
              HttpWebResponse response = (HttpWebResponse)httpWReq.GetResponse();
              string s = response.ToString();
              StreamReader reader = new StreamReader(response.GetResponseStream());
              String jsonresponse = "";
              String temp = null;
              while ((temp = reader.ReadLine()) != null)
              {
                  jsonresponse += temp;
              }
          }
      }
  }
  </code></pre>