Skip to main content

I am developing a Powershell-based deployment model for our Tableau environment utilizing the Tableau Server REST API (Server v10; API version 2.3). I am able to login to server, login to sites, query projects, query workbooks, query data sources, and upload file, but encounter an error when attempting to publish a previously uploaded file:

<error code="400011"><summary>Bad Request</summary><detail>There was a problem publishing the file '10356:81CF357C252F4EA19FE7CE27F9F6B3FD-0:0'.</detail></error>

 

This same file upload succeeds when I execute the Python sample code provided, so I know the .twbx file is good, and the Tableau Server REST API is functioning. Using Fiddler, I have compared line-by-line the PowerShell POST request and Python POST request, and cannot see any differences. I'm not sure what I'm missing. Using PowerShell is a requirement.

 

1. Has anyone successfully published a workbook with the REST API and PowerShell? If so, what's your secret to success?

2. Does Tableau Server have API logs that provide more details than the useless error that is returned?

 

Thanks for any assistance you can provide.

6 réponses
  1. 27 sept. 2016, 19:26

    Hi Chuck

    I have been through the very same issue.

    It seems that using the Powershell Invoke-RestMethod (and Invoke-WebRequest) works fine with text based requests, but does something weird when uploading a twbx, tdsx, or tde.

     

    Therefore I used the System.New.WebClient method instead

     

    The setup is the same as with the Invoke-RestMethod, but using the following process.

     

      $wc = New-Object System.Net.WebClient

      $wc.Headers.Add('X-Tableau-Auth',$headers.Values[0])

      $wc.Headers.Add('ContentLength', $request_body.Length)

      $wc.Headers.Add('Content-Type', 'multipart/mixed; boundary=6691a87289ac461bab2c945741f136e6')

      $response = $wc.UploadString($url ,'POST', $request_body)

     

    The $request_body is of the following format

     

    Hi ChuckI have been through the very same issue.

     

    the boundary=xxxx needs to be the same as the boundary-string in the request_body

    the $url is of the format "http://servername/api/2.2/sites/<siteID>/workbooks"

     

    Hope this helps

     

    All the best

    Glen

0/9000