2 Replies Latest reply on Jun 4, 2018 9:31 AM by James Lamb

    Publish workbook with Tableau Rest API

    James Lamb


      I am trying to automate the deployments of tableau workbooks and datasources.

      Having explored the tabCMD option and found that is seriously flawed as it still does not support nested workbooks I have decided that the Rest API is probably the next best option for me given the requirements.


      To give a bit of background in what I am trying to achieve:

      Currently we are using a product called "Octopus Deploy" for our automated deployments.

      I am trying to write a reusable library for tableau deployments that can be plugged into Octopus.


      Octopus relies heavily on powershell for automation of its deployments and so ideally I would like to make the rest call using powershell.


      After playing around with the Tableau Rest API I cannot for the life of me workout how to successfully publish a workbook.

      Other commands all work perfectly but I am plagued by either a "bad gateway" or "bad request" message when I try to publish.


      My message body is defined below:

      Content-Disposition: name="request_payload"
      Content-Type: text/xml
        <workbook name="IQ_OPTIMIZED">
          <project id="ea94a418-5049-4149-b181-dc3d5f5b4aea"/>
      Content-Disposition: name="tableau_workbook"; filename="IQ_OPTIMIZED.twbx"
      Content-Type: application/octet-stream


      A simple curl request using powershell:

      $body = get-content C:\IQ_OPTIMIZED.twbx
          Invoke-WebRequest "http://tableau-test/api/2.8/sites/341f9e3f-86ac-4daa-9cf5-13cca0a32297/workbooks" -body $body -method post
          write-warning "$($_.Exception.Message)"
          Handle-TableauRestError $_



      The following command using "tabCmd" works fine but it does not allow me to publish to nested projects

      & tabcmd.exe publish C:\IQ_Optimized.twbx --site OilGas --project Analytics -u admin -p xxxxxxxx --overwrite



      If someone could point me in the direction of where I am going wrong I would be very appreciative.

      I do not require a powershell solution (although this would be best)


      Just some pointers on how to get this to work using a simple curl call would be great.