2 Replies Latest reply on Apr 21, 2017 3:01 PM by Chris Sommers

    Download workbook with Python -- Rest API

    Chris Sommers

      Hi all,


      I'm new to Python and the REST API.  What I'd like to do is search a site for workbooks with a specific tag and then download them to a specific folder.  I figured out all of the other functions I need from Tableau's samples but I need help with the syntax for downloading a file with the REST API.


      I've built below as a starting point.  I'm not sure how to incorporate "Content Disposition Header" as referenced in Tableau's documentation.


      Download a Workbook:



      def download_workbook():
          Downloads a server workbook to a specified file location.
          file_path ='C:\\Users\\chsommer\\Desktop\\Test.twbx' #File path for downloaded file
          url = SERVER + "/api/2.3/sites/{0}/workbooks/{1}/content".format(SITE_ID, workbook_id)
          server_response = requests.get(url, headers={"x-tableau-auth": TOKEN})
          if server_response.status_code != 200:



      Any help would be greatly appreciated!