You should be able to do the following:
$params = @{"@type"="login";
"username"="[email protected]";
"password"="yyy";
}
Invoke-WebRequest -Uri http://foobar.com/endpoint -Method POST -Body $params
This will send the post as the body. However - if you want to post this as a Json you might want to be explicit. To post this as a JSON you can specify the ContentType and convert the body to Json by using
Invoke-WebRequest -Uri http://foobar.com/endpoint -Method POST -Body ($params|ConvertTo-Json) -ContentType "application/json"
Extra: You can also use the Invoke-RestMethod for dealing with JSON and REST apis (which will save you some extra lines for de-serializing)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…