title: send post Https request with Content Type application Json on C#
body: <p>I'm trying to send the following request:</p>
  <pre><code> POST /messaging/registrations/(REGISTRATION_ID_FOR_DESTINATION_APP_INSTANCE)/messages   HTTP/1.1
   Host: api.amazon.com
   Authorization: Bearer (MY_ACCESS_TOKEN)
   Content-Type: application/json
   X-Amzn-Type-Version: com.amazon.device.messaging.ADMMessage@1.0
   Accept: application/json
   X-Amzn-Accept-Type: com.amazon.device.messaging.ADMSendResult@1.0
   
   {
  &quot;data&quot;:{&quot;message&quot;:&quot;value1&quot;,&quot;title&quot;:&quot;value2&quot;},
  &quot;consolidationKey&quot;:&quot;Some Key&quot;,
  &quot;expiresAfter&quot;:86400
   }
  </code></pre>
  <p>in order to get a response format like this:</p>
  <pre><code> HTTP/1.1 200
   X-Amzn-Data-md5: t5psxALRTM7WN30Q8f20tw==
   X-Amzn-RequestId: e8bef3ce-242e-11e2-8484-47f4656fc00d
   Content-Type: application/json
   X-Amzn-Type-Version: com.amazon.device.messaging.ADMSendResult@1.0
   Content-Length: 308
    
   {&quot;registrationID&quot;:(REGISTRATION_ID_FOR_DESTINATION_APP_INSTANCE)}
  </code></pre>
  <p>to do that I tried with this code:</p>
  <pre><code>private void sendNotification(String registrationID,String message,
                                            String title,String accessToken)
  {     
   //registrationID content (REGISTRATION_ID_FOR_DESTINATION_APP_INSTANCE) that can vary
   string url = &quot;https://api.amazon.com/messaging/registrations/&quot;+ registrationID +&quot;/messages&quot;;
  
   var client = new HttpClient();
  
   //set Request headers 
   client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
                                                        &quot;Bearer&quot;, accessToken);
   client.DefaultRequestHeaders.Accept.Add(
               new MediaTypeWithQualityHeaderValue(&quot;application/json&quot;));
   client.DefaultRequestHeaders.Add(&quot;X-Amzn-Type-Version&quot;,
                                  &quot;com.amazon.device.messaging.ADMMessage@1.0&quot;);
   client.DefaultRequestHeaders.Add(&quot;X-Amzn-Accept-Type&quot;,
                              &quot;com.amazon.device.messaging.ADMSendResult@1.0&quot;);
  
   //the content of the message body
  
   var content = new Dictionary&lt;string, Object&gt;();
   content.Add(&quot;consolidationKey&quot;, &quot;SyncNow&quot;);
   content.Add(&quot;expiresAfter&quot;, 86400);
   var data = new Dictionary&lt;string, string&gt;();
   data.Add(&quot;message&quot;, message);
   data.Add(&quot;title&quot;, title);
   content.Add(&quot;data&quot;, data);
  
         
   var result = client.PostAsJsonAsync&lt;Dictionary&lt;string, Object&gt;&gt;(url, content).Result;
  }
  </code></pre>
  <p>As response I get StatusCode:400,ReasonPhrase:'Bad Request', I don't know why?</p>
  <p>For detail about result which I got:</p>
  <pre><code>  result    {StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
   {
    x-amzn-RequestId: 1b943a1c-fe94-11e2-b963-71a537223b43
    Vary: Accept-Encoding
    Vary: User-Agent
    Cneonction: close
    Date: Tue, 06 Aug 2013 12:31:24 GMT
    Content-Length: 34
    Content-Type: application/json
   }}    System.Net.Http.HttpResponseMessage
  
   result.RequestMessage  {Method: POST, 
   RequestUri: 'https://api.amazon.com/messaging/registrations/(REGISTRATION_ID_FOR_DESTINATION_APP_INSTANCE)/messages', 
   Version: 1.1, 
   Content: System.Net.Http.ObjectContent`1[[System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],
   [System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], 
   Headers:
   {
    Authorization: Bearer (MY_ACCESS_TOKEN)
    Accept: application/json
    X-Amzn-Type-Version: com.amazon.device.messaging.ADMMessage@1.0
    X-Amzn-Accept-Type: com.amazon.device.messaging.ADMSendResult@1.0
    Content-Type: application/json; charset=utf-8
    Content-Length: 98
   }}       System.Net.Http.HttpRequestMessage
  </code></pre>