0

我正在尝试对 curl 命令使用 invoke-webrequest 或 invoke-RestMethod ,但不能完全正确。起作用的 curl 命令是: curl.exe -X GET -H "Content-Type: application/json" --user 'blahblah:blahblah' https://ourdomain.learnupon.com/api/v1/users

我尝试过: $headers = @{ '--user' = 'blahblah:blahblah' } Invoke-RestMethod -Method Post -Uri 'https://ourdomain.learnupon.com/api/v1/users' -ContentType "application/json" -Headers $headers

并且: $post_values = @{'--user'='blahblah:blahblah'} Invoke-WebRequest -Uri https://ourdomain.learnupon.com/api/v1/users -Method POST -Body $post_value

任何帮助将不胜感激!

4

0 回答 0