Tableau is a traditional BI tool. It is a collection of different views or visualization where each view showcases a different kind of data at the same time. It allows users to get a holistic view of all the data on one screen.
Now lets get into the approach. Everything starts with the Sign-In API. Any Tableau Server REST API requires that you send a credentials token with each request. To get a token, you call Sign-In API and pass credentials of a valid user, either a Personal Access Token (PAT) or a username and password, along with the content URL (subpath) of the site you are signing in to.
Once you have access to Tableau dashboard, you can set up your own PAT token. Check here for more details on this. Note the PAT token and substitute it in the below API.
Request Body:
{"credentials": {"personalAccessTokenName": "<MY_PAT_TOKEN_NAME>","personalAccessTokenSecret": "<MY_PAT_TOKEN_SECRET>","site": {"contentUrl": "<CONTENT_URL>" }}}
Parameters:
MY_PAT_TOKEN_NAME,MY_PAT_TOKEN_SECRET are the PAT token details that you create in the Tableau dashboard UI. By default CONTENT_URL is empty string ("") unless your Tableau team customizes the URL.
If you execute the API with all the required details, you will receive the response like below:
{"credentials": {"site": {"id": "7668ddfd-sdfds-sdfds87-sdfdsds","contentUrl": "https://mydhashboatd.com"},"user": {"id": "6746-sddf78sdfds-sad5763"},"token": "hjhjhdDSDghGHGghGH233jHhhjHJKKJ","estimatedTimeToExpiration": "234:18:27"}}
GET:
http://my-server/api/<api-version>/sites/<site-id>/workbooks/<workbook_id>/views
Parameter Values:
api-version The version of the API to use, such as 3.15.
site-id The ID of the site that we noted above.
Workbook_id The ID that you receive from your development team.
Request Body
None
Once you receive all the views, you need to work with your Tableau development team to identify the relation/mapping between each view and the corresponding dashboard component. For example a single pie chart may have more than one view.
After identifying the views, you can get the data from each view using the below API. Make sure you pass in header “X-Tableau-Auth” with the token.
GET http://my-server/api/<api-version>/sites/<site-id>/views/<view-id>/data
Parameter Values
api-version The version of the API to use, such as 3.15.
site-id The ID of the site that contains the group.
view-id The ID of the view whose details are requested.
Request Body
None
This way you can easily retrieve the data from each dashboard view. This is just a single approach. But these REST APIs provide multiple options for us to receive the data otherwise could be very difficult to extract via UI.