1 Reply Latest reply on Nov 27, 2018 12:14 AM by Gunarathinam Mahalingam

    Update repository location in a workbook using REST API/Python

    Gunarathinam Mahalingam



      I have developed custom deployment tool to move the tableau workbook/data sources from Development server to QA and production.

      Used REST API and Python client library to achieve this.


      Here are steps I followed

      1. Author and publish the datasource in dev server using Tableau Desktop
      2. Refer the published datasource in a worksheet
      3. Publish the workbook in dev server
      4. Do the unit testing and make it ready for release
      5. Save the datasource(.tdsx) and worksheet(.tdwx) files
      6. Push these files to source code repository(Ex - bitbucket)
      7. Using deploy tool,
        1. download the files from repository
        2. Edit the data source connection refers to QA Database.
        3. publish the data source in QA first
        4. Publish the worksheet then in QA using REST API
        5. Run the Full Extract Refresh in QA


      All the above steps are working fine, when we publish the file in dev server using deploy tool.

      When we try to publish in QA server,(step 7.4) I am getting an error response 400011:Bad Request , There was a problem publishing the file 'xxx.twbx'.


      As per my investigation, the data source path embedded in workbook still refers to the published data source of dev server, when I open the workbook in desktop and edit the connection to QA and saving it work for me.


      I found the information about published data source is available under <datasource>\<repository-location> tag of workbook.

      <datasource caption="Sales Data" inline="true" name="sqlproxy.1s9kmkq1uk3frn199ztaw0pmnds3" version="18.1">

            <repository-location derived-from="/datasources/SalesData?rev=1.4" id="SalesData" path="/t/testSite/datasources" revision="1.6" site="testSite" />

            <connection channel="https" class="sqlproxy" dbname="SalesData" directory="/dataserver" port="443" server="tableau-server-dev.com" server-ds-friendly-name="Sales Data" server-oauth="" username="" workgroup-auth-mode="prompt">


      Is there any way to change these information programitically to update the repository location?


      Thanks in advance.