The REST API allows you to query and manage sites, users, groups, workbooks, datasources, projects, and subscriptions/schedules. The automation and integration use cases are effectively infinite, but the most common workflows it is used for in embedded analytics are:
Because the REST API is called via HTTP, you can use whichever programming language is most appropriate. However, there is also the Server Client Library which simplifies the code required. The Server Client Library is currently only available in Python, but more languages are coming soon.
Most commonly, you will make REST API calls from your web application’s server-side code. In some cases, you will want to make those calls client-side (for example, if you are building web pages with no control over the Server-side logic). For those scenarios, Tableau Server enables CORS support.
Below are high-level descriptions of the flows required to enable the most common REST API use cases, but you should read the documentation to learn how to make the individual calls. The concepts section is a good place to start and to learn about subjects such as filtering, sorting, and paginating. Also, be sure to explore the REST API samples repository.
Often, your application will store users. Except in the case of syncing with Active Directory, you will need to replicate those users into Tableau Server. You will likely have a script that adds all existing users to Server as a set-up step, and some code that executes when a new user is added to your system. To add a single user to Tableau Server:
That’s all there is to adding a new user, but you will likely want to make some other calls to ensure the new user has access to the correct content. For example, you may Add the user to group(s). If the group(s) you add the user to have the correct permissions for that user, that may be sufficient, but if not, you can add workbook permissions, add project permissions, or add datasource permissions.
If your users have access to multiple workbooks and datasources, you will likely want to make a Table of Contents page similiar to the below.
And if different users have access to different sets of content, it will not make sense for the list of available content to be hard-coded. Therefore, you need to use the REST API to query the workbooks available to the logged-in user. To achieve the above, you also need to grab the thumbnails.
The typical workflow for building and publishing content is to do it manually with Tableau Desktop. You might need to publish with the REST API for a variety of reasons. For example:
Depending on the size of the workbook or datasource, it may be possible to publish with a single call. If the file is large, you will need to do a send the file in pieces. For more details, see the documentation on publishing with the REST API
Next section: Multi-Tenancy and Row-Level Security