title: Calling a URL via POST method with JSON object, but using Powershell
body: <p>I am attempting to call a specific URL via POST method, where a JSON object is passed as a POST form parameter. The JSON object that needs to be passed is something like this:</p>
  
  <pre><code>obj={
  "login":"[username here]",
  "pword":"[password here]"
  }
  </code></pre>
  
  <p>With Powershell, I was attempting to create a hash and then convert that into JSON, then connect with the Invoke-RestMethod command.</p>
  
  <pre><code>$hash = @{  login = "username"; 
              pword = "password"
              }
  
  $obj = $hash | convertto-json
  Invoke-RestMethod 'https://website.com/login' -Method POST -Body $obj -ContentType 'application/x-www-form-urlencoded'
  </code></pre>
  
  <p>However, this returns an error. Double-checking the documentation, it notes that the form parameter name MUST be <em>obj</em>, as the web services looks specifically for a parameter called <em>obj</em>, takes the string value, then converts it back to a JSON object to retrieve the internal values. </p>
  
  <p>This is where I am getting a little stuck. How exactly can I specific a form parameter name when using Powershell? </p>