I'm new to powershell and trying to make REST API calls to tableau server (version 2018.1) using powershell version 5.1, but I'm getting an issue that I can't seem to fix. The code I'm sending is as follows:
#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
The following error notice appears:
tion 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
Is there anyone who can tell me what I'm doing wrong here?
I've tried changing the formatting of the quotations and such, but it doesn't appear to work.