Using powershell 3 Invoke-RestMethod with Basic Authentication and JSON

This took me a remarkably long time to figure out.  Enjoy!

$user = "myuserid"
$pass= "mypass"

$json = "{
            ""foo"" : ""bar""
          }" 

$secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ($pass, $secpasswd)

Invoke-RestMethod -Uri https://api.intercom.io/v1/users -Method Post -Credential $cred -ContentType "application/json" -Body $json 

Find a problem or mistake? File a bug or better yet, submit a pull request