1 Reply Latest reply on May 3, 2017 10:22 AM by Kevin Peoples

    Publish Data Sources via REST Api with Tableau 10.2 using Python

    Kevin Peoples

      Does anyone have a working example of publishing a Data Source using the REST API.  All the examples that I have seen are to publish a workbook.  I have a working version of publishing a workbook and I have read the documentation and publishing a workbook and data source are not that different.  It seems like it should be straight forward.  However when the final commit is called during a chunk up load process it return an error.

       

      REST API Version 2.5

      Tableau Server Version 10.2

       

      Publish URL:

      https://la-tab01.dev.wkelms.com/api/2.5/sites/897cfb5d-7a1e-4b1e-a81f-77dbec5e0bd4/datasources?datasourceType=tdsx&overw…

       

      Hearders:

      {'Server': 'Tableau', 'Date': 'Wed, 03 May 2017 13:27:14 GMT', 'P3P': 'CP="NON"', 'Connection': 'close', 'Content-Type': 'application/xml;charset=utf-8', 'Transfer-Encoding': 'chunked', 'X-UA-Compatible': 'IE=Edge'}

       

      Payload:

      --b3cdee25335d419f8badbb5ca7b7d42c

      Content-Disposition: form-data; name="request_payload"; filename=""

      Content-Type: text/xml

       

       

      <tsRequest><datasources name="Invoice Fact With Security"><project id="2288b488-7eeb-4e19-a091-18f7479b31f0" /></datasources></tsRequest>

      --b3cdee25335d419f8badbb5ca7b7d42c

      Content-Disposition: form-data; name="tableau_datasources"; filename="Invoice Fact With Security"

      Content-Type: application/octet-stream

       

       

      PK 

       

       

      Response Status:

      Http Status 400

      400000: Bad Request - Payload is either malformed XML/JSON or incomplete

       

       

      I have also tried uploading the file using chunking method.  The checks post with a status of 201, howerver when calling the final method to complete the upload I get the same error message.  400000: Bad Request - Payload is either malformed XML/JSON or incomplete

       

      I have attached the source code.  Currently, the code is forcing the publishing to chuck.