This document explains how to connect the DataTrust product with tableau and read data from its sheets. In tableau, data is stored in the following hierarchy:
- Site
- Projects
- Workbook
- Dashboard and sheets
In order to read data from the tableau sheets, we need to have access to all the above.
Note: We can currently read data only from Tableau worksheets and not its dashboard.
To access a tableau sheet we need to follow the following steps:
Step 1 - API to Get the Site ID
In order to get the site id, we follow these steps –
- Select the profile
- Add the API Widget
- Click on Pre request API to generate the token.
- Select the method as POST.
- Copy the body from the provided file.
- Give the headers as follows.
-
- Provide the URL given for the API token.
- Click on Send
- Select the ‘credentials.token’ from the populated list
- The token will then get added to the header of the API
- Update the key value according to the following format and add the accept key to read the data.
- Click on Get JSON Data to get the total information.
- Select the site array and execute it to get the site information
- From the output select and copy the id of the site where your workbook resides. In the example below the two sites are Default and RDSite. Thus from the id column copy the id of the site where your workbook is.
Step 2 – API to Get the Workbook ID
- Select the profile
- Add the API Widget
- Paste the site id URL copied from the previous output in the Request URL text box.
- Click on Pre-request API to generate the token.
- Select the method as POST
- Copy the body from the provided file
- Give the headers as before.
- Provide the URL given for the API token.
- Click on Send
- Select the ‘credentials.token’ from the populated list.
- The token will then get added to the header of the API
- Update the key value accordingly and add the accept key to read the data.
- Click on Get JSON Data to get the total information.
- Select the workbook array and execute it to get the workbook information
- From the output select and copy the id of the workbook from where you want to read the data. In the below example the name column gives the list of workbooks in their respective projects. Select the workbook id from the id column next to the workbook name column to get the id.
Step 3 – API to Get the View
- Select the profile
- Add the API Widget
- Paste the site id and workbook id URL copied from the previous output in the Request URL text box.
- Click on Pre request API to generate the token.
- Select the method as POST.
- Copy the body from the provided file.
- Give the headers as before.
- Provide the URL given for the API token.
- Click on Send.
- Select the ‘credentials.token’ from the populated list.
- The token will then get added to the header of the API.
- Update the key value accordingly and add the accept key to read the data.
- Click on Get JSON Data to get the total information.
- Select the sheet array and execute it to get the sheet information
- From the output select and copy the id of the sheet from where you want to read the data. In the below example there are only two sheets Growth Rates and Learn More. So, you can select the id of the sheet where your data resides.
Step 4 – API to Get the Sheet Data
- Select the profile
- Add the API Widget
- Paste the site id, workbook id, and sheet id URL copied from the previous output in the Request URL text box.
- Click on Pre request API to generate the token.
- Select the method as POST.
- Copy the body from the provided file.
- Give the headers as before.
- Provide the URL given for the API token.
- Click on Send
- Select the ‘credentials.token’ from the populated list.
- The token will then get added to the header of the API.
- Update the key value according to the following format and add the accept key to read the data.
- Click on Preview data to read the data from the sheet.