417对tableau restapi powershell脚本的预期失败
我在powershell相对较新,尝试使用powershell版本5.1创建REST API调用,调用tableau服务器(版本2018.1),但是我遇到了一个无法摆脱的错误。我要传递的代码如下:417对tableau restapi powershell脚本的预期失败,rest,powershell,tableau-api,Rest,Powershell,Tableau Api,我在powershell相对较新,尝试使用powershell版本5.1创建REST API调用,调用tableau服务器(版本2018.1),但是我遇到了一个无法摆脱的错误。我要传递的代码如下: #Variables: $sites = 'site' $APiversion = '3.0' $DeployPassword = 'Password123' $DeployUser = 'Defaultuser' $Tableauservername = 'servername' # ge
#Variables:
$sites = 'site'
$APiversion = '3.0'
$DeployPassword = 'Password123'
$DeployUser = 'Defaultuser'
$Tableauservername = 'servername'
# generate body for sign in
$signin_body = (’<tsRequest>
<credentials name=“’ + $DeployUser + ’” password=“’+ $DeployPassword + ’” >
<site contentUrl=“” />
</credentials>
</tsRequest>’)
#[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$response = Invoke-RestMethod -Uri https://$Tableauservername/api/3.0/auth/signin -Body $signin_body -Method post -UseBasicParsing
有人知道我做错了什么吗
我已经更改了引号等的格式。似乎不起作用。尝试使用
-Headers
参数设置Expect标头。我已经尝试过,但不知道该放在那里什么,它应该放在正文中还是放在rest方法中?您尝试过-header@{}
或-header@{Expect=”“}
可能?我重新启动了powershell控制台,它似乎(暂时)解决了可能重复的问题
417 Expectation Failed
Expectation Failed
The expectation given in the Expect request-header
field could not be met by this server.
The client sent
Expect: 100-continue
Only the 100-continue expectation is supported.
At line:16 char:13
+ $response = Invoke-RestMethod -Uri https://$Tableauservername/api/3.0 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand