3/10/2019 updated 12/27/2019
Using the Tableau Public API in 3 Easy Steps
In this blog post I will outline how you can get quick and easy statistics on any Tableau Public Profile using the Tableau Public API, and how to batch download Tableau workbooks from a Tableau Public Profile page. There are already some good blog posts on this topic and a terrific community resource called The Cerebro Project that was built and is maintained by Josh Tapley. However, it's pretty easy to pull your data, or anyone's data, using the Tableau Public API in just a few steps.
Step 1: Build a URL using the Tableau Public Profile Name
The URL is pretty straight forward:
https://public.tableau.com/profile/api/[Profile Name]/workbooks?count=300&index=0
The data will return in JSON format. Right-click and save the file.
Note - The parameter count=300 is the maximum number of records, so if you need the full the data for someone that has more than 300 visualizations on their Tableau Public profile page, then you will need to use the second parameter Index. Since the Index starts at 0, then the second set of 300 starts at 300 and increases in increments of 300.
Step 2: Load into Tableau (or parse the JSON if you like)
You could parse the JSON with any number of tools, for example using Alteryx, but there really is no need to do this since Tableau can import JSON directly.
Select Data in the menu and select "New Data Source".
Choose JSON and select the file.
The default schema selection should work without any configuration, so click OK.
If you have more than one JSON file, as in Andy's example above, then simply drag the additional JSON files in the data import window to Union them together.
You now have the data in Tableau.
Step 3: Build a Viz
Below is a sample viz that shows the information from my Tableau Public Profile page. The fields are pretty self-explanatory. I created two calculated fields that are built by combining a few fields into a URL, one for the Thumbnail view and the other to download the Tableau workbook.
Using a dashboard action we can view a thumbnail of a viz or download the viz. There are also fields that you might useful, for example; View Count, Number of Favorites, Allow Data Access, Show in Profile, and Revision.
Update: Thank you Annabelle Ricon for catching the bad date format and providing a formula to convert to a proper date.
Calculated Field: Date
Formula: // Date First Publish converted to a date format // Thank you Annabelle Ricon for catching this and providing a formula to resolve the date date(dateadd('second', int(int([First Publish Date per Document])/1000), #1970-01-01#))
Using a dashboard action we can view a thumbnail of a viz or download the viz. There are also fields that you might useful, for example; View Count, Number of Favorites, Allow Data Access, Show in Profile, and Revision.
Batch Download Visualizations or Images
Back in December 2017, I wrote a blog post on how to batch print PDF for Tableau Public or Tableau Server. One of the additional features I outlined in this post is that you can batch download PNG, CSV or TWBX files. We can use the list of Full URLs that we created from the JSON output above to create a list of visualizations. Once we have the list, we can leverage the steps from my batch PDF blog post to batch download all of the visualizations from a Tableau Public account.
Follow the steps above to get the JSON, import into Tableau, create the FULL URL field (or use Thumbnail to download all of the images). Then copy the contents of that field to get a list of links. Simply drop the list of links in place of the list of PDF links in that blog post.
Below is the sample HTML code used to create a download button to download 10 visualizations from my Tableau Public Profile page: Note: see the browser restrictions outlined in the December 2017 blog post.
I hope you find this information useful. If you have any questions feel free to email me at Jeff@DataPlusScience.com