Display the View with the Ticket
After you create the POST request, you need to write code that provides the web server with the view’s location and the ticket from Tableau Server. It will use this information to display the view. How you specify it depends on whether the view is embedded, and if Tableau Server is running multiple sites.
Tableau Server View Examples
Here’s an example of how to specify a view that users only access via Tableau Server (the view is not embedded):
http://<server_name>/trusted/<unique_ticket>/views/<workbook_name>/<view_name>
If Tableau Server is running multiple sites and the view is on a site other than the Default site, you need to add t/<site_id>
to the path. For example:
http://<server_name/trusted/<unique_ticket>/t/Sales/views/<workbook_name>/<view_name>
Use the same capitalisation that you see in the Tableau Server URL.
Embedded View Examples
Here are some examples of how to specify embedded views. Because there are two approaches you can take with embed code, both ways are provided below. Regardless of which you use, there is some information unique to trusted authentication that you must provide. For more information,
Note: The examples below use embed code parameters. For more information, see Embed Code Parameters(Link opens in a new window) in the Tableau Help.
Script Tag Examples
This example uses the ticket
object parameter:
<script type="text/javascript" src="http://myserver/javascripts/api/viz_v1.js"></script> <object class="tableauViz" width="800" height="600" style="display:none;"> <param name="name" value="MyCoSales/SalesScoreCard" /> <param name="ticket" value="9D1ObyqDQmSIOyQpKdy4Sw==:dg62gCsSE0QRArXNTOp6mlJ5" /> </object>
Here’s what the above example looks like for a multi-site Tableau Server, where the view is published on the Sales
site:
<script type="text/javascript" src="http://myserver/javascripts/api/viz_v1.js"></script> <object class="tableauViz" width="800" height="600" style="display:none;"> <param name="site_root" value="/t/Sales" /> <param name="name" value="MyCoSales/SalesScoreCard" /> <param name="ticket" value="9D1ObyqDQmSIOyQpKdy4Sw==:dg62gCsSE0QRArXNTOp6mlJ5" /> </object>
Instead of using ticket
, you can use the path
parameter to state the full path of the view explicitly. When path
is used, you do not also need the name
parameter, which is usually a required parameter in Tableau JavaScript embed code:
<script type="text/javascript" src="http://myserver/javascripts/api/viz_v1.js"></script> <object class="tableauViz" width="900" height="700" style="display:none;"> <param name="path" value="trusted/9D1ObyqDQmSIOyQpKdy4Sw==:dg62gCsSE0QRArXNTOp6mlJ5/views/MyCoSales/SalesScoreCard" /> </object>
Here’s the same example, but for a multi-site server. Note that /t/<site_id>
is used here:
<script type="text/javascript" src="http://myserver/javascripts/api/viz_v1.js"></script> <object class="tableauViz" width="900" height="700" style="display:none;"> <param name="path" value="trusted/9D1ObyqDQmSIOyQpKdy4Sw==:dg62gCsSE0QRArXNTOp6mlJ5/t/Sales/views/MyCoSales/SalesScoreCard" /> </object>
Iframe Tag Example
<iframe src="http://tabserver/trusted/9D1ObyqDQmSIOyQpKdy4Sw==:dg62gCsSE0QRArXNTOp6mlJ5/views/workbookQ4/SalesQ4?:embed=yes" width="800" height="600"></iframe>