title: C# json POST request 400 error
body: <p>Trying to get a json post request to work. The error seems to be with the request body as per the error response. Cant seem to figure out the reason. If i post the same request body string through POSTMAN, i get a success response.</p>
  
  <pre><code>var bodyData = new
  {
  id = "1234567",
  eventType = "create",
  userId = "account-70540"
  }
  var js = new JavaScriptSerializer();
  string reqBody = js.Serialize(bodyData);
  </code></pre>
  
  <p>In the section where the request is processed:</p>
  
  <pre><code>HttpWebRequest request = WebRequest.Create(reqUrl) as HttpWebRequest;
  request.Method = "POST";                
  request.ContentType = "application/json";
  request.Headers.Set("x-tracking-id", "12345");
  HttpWebResponse response = request.GetResponse() as HttpWebResponse;
  </code></pre>
  
  <p>The last line triggers the exception and i get a 400 Bad request.Unexpected error while decoding json: Message entity must not be empty.</p>
  
  <p>If i copy the string reqBody and use it as a body in Postman, it works.
  Could you help with what i'm missing please.</p>