powershell利用curl发送请求,json的数据怎么提交


PowerShell交流中心分类: 变量-函数-脚本-条件-循环-参数powershell利用curl发送请求,json的数据怎么提交
0
高黎明 asked 6年 ago

利用curl发送http请求,json数据怎么做为参数传上去?
能不能给个命令的例子。

1 Answers
-1
Mooser Lee 管理员 answered 6年 ago
$uri = 'https://www.pstips.net/restapi/v2'

$hash = @{ name = "$name";
           pwd = "$passwd";
        }

$JSON = $hash | convertto-json
curl -uri $uri -Method POST -Body $JSON