title: how to recreate a working CURL command with Invoke-WebRequest in Powershell
body: <p>This curl command works as desired:</p>
  
  <pre><code>curl -H "X-Api-Key:j65k423lj4k2l3fds" `
       -X PUT `
       -d "alerts_enabled=true" `
          https://some/working/file.xml
  </code></pre>
  
  <p>How can I recreate this natively in PS with <code>Invoke-WebRequest</code>? I've tried</p>
  
  <pre><code>Invoke-WebRequest -Headers @{"X-Api-Key" = "j65k423lj4k2l3fds"} `
                    -Method PUT `
                    -Body "alerts_enabled=true" `
                    -Uri https://some/working/file.xml
  </code></pre>
  
  <p>I've also tried making objects for all the params (e.g. <code>$headers = @{"X-Api-Key" = "Key:j65k423lj4k2l3fds"}</code> and passing <code>-Headers $headers</code>).</p>
  
  <p>Thanks</p>