【发布时间】:2021-05-12 16:10:01
【问题描述】:
我正在尝试简化我的 http 请求,但是查询参数似乎会导致问题,我无法弄清楚问题是什么。
作品:
$endpoint = "https://testendpoint.com/test?param1=value1¶m2=value2&apikey=keyvaule"
Invoke-RestMethod -Uri "$endpoint" -Method 'Post'
失败:
$body =
@{
param1='value1';
param2='value2';
apikey='keyvalue';
}
$endpoint = "https://testendpoint.com/test"
Invoke-RestMethod -Uri $endpoint -Body $body -Method 'Post'
我尝试了几种不同的变体。任何帮助将不胜感激
【问题讨论】: