title: POST request with Powershell 2.0 using cURL
body: <h2>Scenario</h2>
  
  <p>Among other things, Powershell 2.0 doesn't have the useful cmdlet Invoke-RestMethod.</p>
  
  <p>I can't upgrade to version 3 and most examples I've found use version 3.</p>
  
  <p>I have found <a href="http://gallery.technet.microsoft.com/ScriptCenter/7e7b6bf2-d067-48c3-96b3-b38f26a1d143/" rel="noreferrer">this article</a>, which seems, however, too complicated for my simple scenario.</p>
  
  <p>I need to write a Powershell script that POSTs data in Json format, e.g.</p>
  
  <pre><code>{"Id":5,"Email":"test@com","DataFields":null,"Status":0}
  </code></pre>
  
  <h2>What I've tried</h2>
  
  <p>I am able to GET data. This is one of the scripts I have tried.</p>
  
  <pre><code>curl -v --user username:password https://api.dotmailer.com/v2/account-info
  </code></pre>
  
  <p>But, when I try to POST, I can't figure out where to put the body of the message in the script. This is what I've got so far:</p>
  
  <p><code>curl -v -X POST -H "Accept: application/json" -H "Content-Type: application/json" -u username:password -d '{"Id":5,"Email":"test@com","OptInType":0,"EmailType":0, "DataFields":null,"Status":0}' https://api.dotmailer.com/v2/contacts</code></p>
  
  <p>which returns the following error:</p>
  
  <p><code>{"message":"Could not parse the body of the request based on the content type \"application/json\" ERROR_BODY_DOES_NOT_MATCH_CONTENT_TYPE"}*
  </code></p>
  
  <h2>Question</h2>
  
  <p>Can anyone advise on how to POST Json data from Powershell using cURL?</p>
  
  <p>Any pointers to why I get the error I mentioned in the Waht I've tried section would be much appreciated.</p>
  
  <p>Thanks.</p>