Я относительно новичок в powershell и пытаюсь создавать вызовы API REST с powershell версии 5.1 на сервер таблиц (версия 2018.1), однако я получаю сообщение об ошибке, от которого не могу избавиться.Код, который я передаю, следующий:
#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
Я получаю следующее сообщение об ошибке:
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
Кто-нибудь знает, что я здесь делаю неправильно?
Я уже изменил форматирование кавычек и т. Д., Похоже, не работает.