Continuing from my experience with Tableaus Coder Initiative, I returned to working with the Tableau Rest API.
This post examines a generic use case for plausibility.
Salesforce Superstore Data Source
I started with the Salesforce Superstore data source, a sample data source offered by Tableau. I did a little bit of exploration and found that it might be interesting to create three separate workbooks based on segment.
Imagine that we want to improve overall across the organization. We took a look at our customer base, current dashboards, and realized that there are striking similarities between segments, but there are a few extra things we’d like to review in the corporate segment that don’t apply to the consumer segment.
We know that a customer can only belong to one segment and that we’d like to roll out three workbooks using a template, with the data source filtered to the specific segment. Using the Tableau Rest API or Tableau Server Client, we think that we may programmatically create and filter the workbooks from the template.

Query the Data Source
We need to query the data source for the unique segments. In order to accomplish the first part of the task for creating these filtered workbooks programmatically, we must first query the data source.
The documentation does not contain information on how to query a Tableau data source via the Tableau Rest API. I downloaded the data source. After all, in the real world, I’d be able to query my data source directly and wouldn’t require the Tableau API for access to this information. A local copy of the dat source couldn’t hurt.
I downloaded the data source using the Tableau Server Client. However, a problem arose when it came time to open and read the data source. The Tableau Rest API and Tableau Server Client expect a hyper extract file. This is good news if you’re ever in the mood to query one of the hyper extracts that you’ve created, but the downloaded source is not a hyper extract, but rather a .tdsx file.
According to the Tableau forums, a .tdsx file is just a different name for a zipped file. After changing the extension to .zip and unzipping the file, I tried the hyper extract API as suggested. The extracted data isn’t a hyper extract. It’s an Excel file. Fantastic! Using pandas, I can query the data source for the unique segments.

Set a Workbook Filter – To be Continued or Abandoned?
I want to set a workbook filter using the API. In scouring the documentation, it does not seem that this feature is available in the Tableau API. I have reached out to the Tableau Community via the forums – to see if I’m over looking something. The question can be found at : https://community.tableau.com/s/question/0D58b0000AEiy0sCQB/how-can-i-set-a-workbook-filter-using-the-tableau-rest-api
This post may be continued at a later date or the project abandoned in its entirety. At least we learned how to download a data source and that it is possible to query a hyper extract using the Hyper Extract API.
Leave a Reply