调用Web服务如何添加参数

时间:2019-05-04 07:03:58

标签: powershell

postman demo

我使用以下代码调用了Web服务,但是没有用。我已经使用邮递员成功进行了测试。这是演示。

1 个答案:

答案 0 :(得分:0)

尝试一下:

$body = @{ 
"access_token" = "24.b305c9822131e65eda05e29c157dd719.2592000.1559103982.282335-16139329";
"image" = "base64"; 
"language_type" = "CHN_ENG";
"probability" = "true";
"detect_direction" = "true"; 
} 
$header = @{ 
"Content-Type" = "application/x-www-form-urlencoded"
} 


$response = Invoke-RestMethod -Uri "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic" -Method POST -Body $body -Headers $header  | ConvertTo-Json

$response | Out-File C:\filename.txt