<< Back

Getting into the Undocumented Tableau Server API

Before we start to take a look at getting into the Tableau Server API let’s take a look at what’s possible…

Quick Access to your Workbooks & Data Sources

Do you use Google Chrome & love Tableau Server, Public and/or Online? You can go get the Google Chrome Extension for Tableau Server

Google Chrome Extension for Tableau Server

Publish Data Directly from Alteryx

Have Alteryx Designer? Want to get your data directly into Tableau Server from your module’s workflow? You’re going to want our Alteryx Tools for Tableau

Alteryx Tools for Tableau

How to Get Started

So how’s it best to get started? First of all download Fiddler, run it and start to interact Tableau Desktop or Tabcmd with Tableau Server. Make a interaction, for instance sign in to Tableau Server from Tableau Desktop, and take a look at what’s been captured by Tableau Server.

Server Authentication

There are a number of ways to authenticate pragmatically with Tableau Server, each with varying difficulty

[Easy] Use the browser

When you login to your Tableau Server through the portal Tableau creates an authentication cookie on your local machine which can be used in subsequent calls. Therefore if you first login as usual to your server you can then use your browser to read from the API.

[Easy] URL tags

It is possible to just add your username and password to your server URL. Simply append the following to your server URL:

/auth/login.xml?username=…&password=…

Substituting the … for your username and password.

Beware though this will send your password in free text across your network and at worse across the internet.

[Difficult] Encrypt the password with RSA

The Tableau Server portal by default encrypts your password between the login form in the local web browser and the server itself. In order to encrypt the password for API authentication you’ll need a few things. First of all call /auth.xml on your Tableau Server and grab the modulus, exponent & authenticity_token from the resulting XML as well as the workgroup_session_id, now known as the cookie, from the call’s header. You’ll see all this information coming through in Fiddler while testing out your method.

Next you’ll need to actually do the encryption. Tableau Server uses javascript to do this, the code you’ll need can be copied from here. At the base of the code you’ll see places to insert the modulus, exponent and password to be encrypted. The result will be the encrypted password.

Finally your code will need to POST all this information to /auth/login.xml on the Tableau Server with the cookie as the header and cypted, authenticity_token & username in the payload with ‘crypted’ being the encrypted password.

The resulting XML will again have a workgroup_session_id in the call’s header which is appended to the end of following string ‘username=;’ to create the final session cookie. That cookie should then be placed in the header of all subsequent calls you make to the Tableau Server.

What Can You Do?

One of the best places to look at possible calls, other than what you can capture through Fiddler, is the /auth.xml page on your Tableau Server.

For instance to list all the views on your sever:

<ListViewsUrl>
    <ssl>no</ssl>
    <url>/views?format=xml&all=true</url>
</ListViewsUrl>
You’ll need to call /views?format=xml&all=true
<SearchUrlT>
    <ssl>no</ssl>
    <url>/searches?format=xml&all=true&query=%s&intent=%s</url>
</SearchUrlT>
Replacing %s with a query string returns in XML all views & datasources which match the query string given.
Finally my favourite…
<DSNoExtractUrlT>
    <ssl>no</ssl>
    <url>/datasources/%s.tds?no_extract=true</url>
</DSNoExtractUrlT>
…will download a datasource from the Tableau Server without the attached TDE. This is fantastic if you want to make small changes to your datasource but making it local downloads a large amount of data.

Tell us what you get up to

We’d love to hear what you end up creating from the Tableau Server API. Please either post a comment or send us an email info@theinformationlab.co.uk

Craig Bloodworth

York, UK

14 thoughts on “Getting into the Undocumented Tableau Server API

  1. Getting this error from the “Publish to Data Server” macro. Any ideas?
    Error: Publish to Data Server (162): Tool #25: Record #1: Tool #1: The external program “curl.exe” returned an error code: -1073741512

  2. I would like to ask if there a method to write own from of authorization to access Table Workbook?

    I have tried REST API, receiving Token. Now I thought to insert this token into cookie as “workgroup_session_id” – but it looks it is impossible due security reasons. Any Ideas?

  3. Hello everyone could help me with detailed steps because when I open alteryxs displays only an option in Server I Login-> Target Site->
    Repopulate dropdown for a new URL – current URL = https://online.tableausoftware.com/,Run

    and I do not understand why others leave them more, help with the steps of the solution.

  4. The method of logging in with URL tags doesn’t seem to work with multiple sites. Is this the case or am I missing something?

  5. Hi. I tried to use the server login and Publish to Data Server tools. It successfully logged in to our tableau online, but not publishing the data source, getting this error – “No entity found for query”. I tried to publish fresh data source and also tried to overwrite the one already existing in the tableau server. Same issue both the time. Can someone help me on this ?

  6. Hi Again,

    I think, I got the reason, its working when I point to our tableau server, but throwing “No entity found for query” error when I point to tableau online. Can someone help me on this?

Leave a Reply

Your email address will not be published. Required fields are marked *