tableauandbehold.com is the blog home of the tableau_tools Python library, which is always available via:
tableau_tools includes the tableau_rest_api sub-package, which is a full implementation of all Tableau REST API capabilities and some other useful capabilities (such as programmatic data source changes and field name localization).
The officially supported library for working with Tableau Server REST API is called the Tableau Server-Client library. For most basic use cases, TSC will suffice, but tableau_tools is optimized for complex use cases, particularly when Tableau Server is embedded or integrated into other web applications.
Info on tableau_tools library
If you are getting started using the tableau_tools library, there is an examples directory. I personally use PyCharm as an IDE for developing — the library was written using PyCharm and the autocomplete functions make it very quick to write useful scripts.
The README file is a full guide to the library and is essential reading when getting started.
Internationalization / Localization
Creating “localized” workbooks from a template
Info on the Tableau REST API
The Tableau REST API itself is completed documented on the Tableau Online Help. The following posts described how it works and what to take into consideration if implementing yourself. For topics that are implemented in the tableau_tools library, the posts in the section above may also include the relevant info on “why” as well as “how”.
https://tableauandbehold.com/2015/08/06/tableau-rest-api-400-error-response-code-400011/
I don’t believe that showing the view name is working correctly. Here is what I’m using to get it:
tab_srv.signin()
view_names = []
workbook_luid = tab_srv.query_workbook_luid_for_username_by_workbook_name_in_project(username, workbookname, projectname)
views = tab_srv.query_workbook_views_by_luid(workbook_luid)
print views
When this is run, it simply returns:
I’m hoping I’m just doing something incorrectly
LikeLike
Hi Steve,
All of the query methods return lxml objects that represent all of the information returned by the API call (You can see what these look like in the Tableau REST API Reference manual) There is a method you can use to convert the lxml object into a name => luid pair like this: views_dict = tab_srv.convert_xml_list_to_name_id_dict(views)
This should work in most cases, although it might break if you have views that are named the same thing
LikeLike