我已经成功地使用Invoke-WebRequest从 PowerShell 向基于 REST 的 API 发布请求。
Invoke-WebRequest -UseBasicParsing https://my-rest-api.com/endpoint -ContentType "application/json" -Method POST -Body $json
Run Code Online (Sandbox Code Playgroud)
今天我遇到了Invoke-RestMethod听起来更贴切地命名我正在做的事情。有什么区别,是否有理由使用一个而不是另一个?