10 Replies Latest reply on Jan 21, 2016 9:00 PM by Vien Hua

    REST API to open a tableau view

    Srinu Babu

      Hello All


      I am using Tableau REST API    "/api/2.0/auth/signin"  to sign into my tableau server and I receive the following token


         <?xml version="1.0" encoding="UTF-8"?>

      <tsResponse xmlns="http://tableausoftware.com/api" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tableausoftware.com/api http://tableausoftware.com/api/ts-api-2.0.xsd">

        <credentials token="76c6fe57f9c25b669cbf999f66ebfc3f">

        <site contentUrl=""/>





      now that have the token How do I invoke a View?


      OR do we have any other way using JavaScript API?


      FYI I am using C# to make REST calls.




        • 1. Re: REST API to open a tableau view
          Ray Choe

          how u got this Auth token?

          I mean r u using any programming language?

          • 2. Re: REST API to open a tableau view
            Srinu Babu

            Yes C#.


            On Friday, October 10, 2014, Ray Choe <tableaucommunity@tableausoftware.com>

            • 3. Re: REST API to open a tableau view
              Vien Hua

              Hi Srinu,


              The REST API wasn't meant for invoking views (displaying them) if that's what you mean. It'll simply query metadata information about a site, project, workbook, view, data source, or user. Or do administrative things such as adding and deleting sites, users, etc. But essentially once you have the access token, you can make another GET or POST request to perform other administrative functions. See http://onlinehelp.tableausoftware.com/current/server/en-us/help.htm#rest_api_ref.htm.


              If you want to display views, use the JavaScript API: http://onlinehelp.tableausoftware.com/current/server/en-us/help.htm#js_api.htm


              Let me know if you have any other questions



              • 4. Re: REST API to open a tableau view
                Janusz Jasinski

                It doesn't return metadata info about a project though - you can query sites/workbooks etc but not projects


                For instance, I can't see what workbooks are within a project


                In fact, there's no easy way to get user ID of the current logged in user

                • 5. Re: REST API to open a tableau view
                  Vien Hua

                  Unfortunately that's true at the moment. There's no API to query which objects belong to a certain project. For that, I suggest querying the PostgreSQL database.


                  Are you referring to the username or user's LUID? You already know the username because that's what you use to make the initial request. Then you can query Users on Site to get the LUID for users.

                  • 6. Re: REST API to open a tableau view
                    Janusz Jasinski

                    Hi, thanks for the reply!


                    I am taking about the LUID. Unfortunately this doesn't help me either


                    1. I have 4 sites
                    2. One site has the same user (me) three times - wrong
                    3. One site has the same user (me) two times - wrong
                    4. The other two sites contain one instance of me - correct
                    5. In each of the 4 sites, my username has a different ID


                    Is there any documentation about querying the PostgreSQL database?

                    • 7. Re: REST API to open a tableau view
                      Vien Hua



                      Like I mentioned in Re: REST API Questions, the duplicate names issue will be fixed in 8.2.4, the next release of Tableau Server.


                      To query the PostgreSQL database, first enable access to it by following the steps here: http://onlinehelp.tableausoftware.com/current/server/en-us/help.htm#adminview_postgres_access.htm


                      Then use any tool, such as Tableau Desktop, or write your own SQL script to query the database for info you want.   

                      • 8. Re: REST API to open a tableau view
                        Janusz Jasinski

                        Ok thanks – it would be great when authenticating the user, their ID be brought back in the response payload


                        Then using that ID we can see what sites/projects/workbooks and views that user has access to , along with being able to query each of them


                        This would be ideal

                        • 9. Re: REST API to open a tableau view
                          Nagendra Kinthalli

                          Hi Vien,

                          Thanks for the information!

                          I tried to display the view using Javascript API tutorial. Every view in my tableau server having share option. I clicked it and took the embed code. I added the parameters for token and finally used the below script in my cshtml [ASP.net MVC project]


                                <script type='text/javascript' src='http://abc.com/javascripts/api/viz_v1.js'></script>

                                                          <div class='tableauPlaceholder' style='width: 940px; height: 662px;'>

                                                              <object class='tableauViz' width='940' height='662' style='display:none;'>

                                                                  <param name='host_url' value='http://abc.com/' />

                                                                  <param name='site_root' value='/t/SiteName' />

                                                                  <param name='name' value='ABCDashboard/ABCView' />

                                                                  <param name='tabs' value='yes' />

                                                                  <param name='toolbar' value='yes' />

                                                                  <param name='showVizHome' value='n' />

                                                                  <param name='bootstrapWhenNotified' value='y' />

                                                                  <param name='filter' value=':openAuthoringInTopWindow=true' />

                                                                  <param name='filter' value=':browserBackButtonUndo=true' />

                                                                  <param name='filter' value=':reloadOnCustomViewSave=true' />

                                                                  <param name='filter' value=':showShareOptions=true' />

                                                                  <param name="ticket" value='@Session["token"]' />





                          However I could see the 403 forbidden error showing the below error in the page. Could you please help me on this.


                          • 10. Re: REST API to open a tableau view
                            Vien Hua

                            Hi Nagendra, it looks like you were able to successfully get a ticket. That specific error message is typically a result of one of the following:

                            • Redeeming the ticket more than once (this is often the case), even though you aren't aware of it. The Tableau Server httpd access logs will prove this however.
                            • The ticket you used is for a different site than originally requested for. Check again if you are requested a ticket from the default site or another site, and then make sure you use that ticket on the site you requested.

                            If anything, reproduce the issue, get ziplogs, and send it to support@tableau.com