I am relatively new at powershell and trying to create REST API calls with powershell version 5.1, to tableau server (version 2018.1), however i am getting an error i am unable to get rid of. The code i am passing is the following:
#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
I'm getting the following error message:
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
Doe s anyone know what i am doing wrong here?
I already changed formatting of quotes etc. does not seem to work.