Alteryx and the Tableau Server API

Hello again all,

Recently, I was asked about downloading workbooks from the Tableau server, in order to ensure local copies were in sync with the published version. From past experiences of being an “accidental server admin” I knew that this was possible with the Tableau Server REST API, and since I was working with a team who had just made an investment in Alteryx, this was a great opportunity to show them the power of the platform.

I love Alteryx for the way it extends my knowledge and capabilities for projects like this. You see, I’m not much of a coder (yet). I’ve recently begun to dabble in Python and some other languages, but I have a long way to go. But, I can write SQL all day long and crack complex calculations in BI tools like Tableau or Power BI. So, I do understand a bit about the LOGIC of programming, like how to break down a problem into parts and organize them. This is where Alteryx is such a perfect tool for me. It can do the lifting in places where I don’t have the coding quite down yet. In this case, I was able to get a working proof of concept built in just a couple of hours. Alteryx really does provide the thrill of solving!

Before you start

Before I get too into the what’s and how’s of this project, a few disclaimers.

  • If you’re completely unfamiliar with using REST APIs, this might be a good introduction because it combines a few different call methods. But, you’ll get farther if you do some reading on the topic. I leaned heavily on the Tableau help pages, and specifically, the Getting Started Tutorial.
  • I am not an expert in REST APIs, and this was my first experience using Alteryx to handle something like this. As is usually true with Alteryx, there are probably other paths to accomplish this task. If you have one, I’d love to hear about it!
  • If you are NOT the Tableau Server admin, I recommend reaching out to your admin about what you’re trying to do. They may already have experience, or processes built in something like TabPy to do what you need to do. No need to recreate the wheel here, and always best to leverage existing expertise if you have it. They may also have a test environment you can use for practice, if you’re just looking to learn a bit more.

What you’ll need

  • Alteryx Download Tool
    • This is where our heavy lifting will be done in Alteryx. If you’re unfamiliar with the Download tool, check out the Tool Mastery Page for information, links and example use cases.
  • Alteryx XML Parse Tool
    • The responses from the REST API come in XML format, so we’ll be using the XML parse tool to interpret the responses.
  • Tableau REST API documentation
    • This tells us what we need to make our calls, and how to get them in the right format.
  • Permission to download workbooks on the server. You won’t be able to do anything with the REST API that you can’t do on the server already.

Authenticating to the API

Tableau recommends using a Personal Access Token for interacting with the Server API. This prevents you from having to hard code your credentials anywhere in your workflow, and can be used to sign your workflow in and out of the API session. For information on setting up an access token, see this Tableau help page on the topic.

Once you have your token, you are ready to get started. Here is what the first section of my workflow looks like.

Authenticating to the API

The text input tool has 3 columns:

  • The sever URL for authentication. Example: https://<YOUR SERVER URL>api/3.6/auth/signin
  • The name of your Personal Access Token.
  • The personal access token you got from the server

Then, I used a formula tool to build the command we need to send the API. This came right out of Tableau’s documentation. Then we use the Download tool to make a POST command and authenticate, and the XML parse to interpret the response.

Getting the List of Workbooks

The method for downloading a workbook is pretty straightforward (see the help documentation). We simply need to create a URI that matches the designated format.

The site-id value is parsed out of the XML response from our authentication step, so we have that piece ready to go. If we know which workbook(s) we want to download, we can simply put them into the call above and we’d be all set. But, since I wanted to get all of the workbooks, I needed to get the list of workbooks first. To do that, we make a similar call to the URL, and simply leave off the “/content” piece of the URI above.

The above section of the workflow handles this part of the job. It makes a call to the API to get the list of workbooks (after using a formula tool to construct the URL of the request) and parses the results. This gives us a list of the workbooks on the server (that we have access to), along with their workbook-id values. With those, we can use another formula tool to build the URI call for each workbook we want to download. I also kept the “Updated At” column, so I could the version date to each file when I downloaded them.

After this download, we almost have what we need. In my case, I had a mix of .twb and .twbx formats, and I wanted to make sure I saved the files in the right format, so I added this section to my workflow.

Here I used a bit of RegEx to pull out the workbook name and format, so I could construct a file path to save the downloaded workbooks to. That looks like this:

I get the workbook name by parsing the File Name up to where I found “.twb”. Next, I added a space and the date derived from the “Updated at” column we captured earlier. Last, I get the extension (.twb or .twb), by pulling the rest of the File Name string, starting at .twb.

Downloading the Workbooks

Now, we have everything we need to download our workbooks. We have a the list of workbooks, meaningful file names for them, and the location we want to save them to. Now we can go back to this format for the download URI.

And build the last section of the workflow.

Here we are sending the call to download each workbook, and save them to the file path we created earlier. I configured the Download tool to output results to “Filename from a field” and pointed it at the path created earlier. That is the first Download tool in this section. The rest of this section takes the original URL and auth token and sends a sign out message to the API so it knows we are done. All-in, the workflow looks like this:

My completed workflow

Wrapping Up

Alteryx touts the “Thrill of Solving” and I definitely felt that working on this. I embraced the thrill of learning something new (interacting with an API) combined with my working knowledge of Alteryx and Tableau and had a working solution in less than one afternoon. That’s powerful. Powerful for the team who now sees Alteryx in a different light. Powerful that I can lean on a platform like Alteryx for this now, and know that it will only grow with me as my coding skills grow.

In the end, success in this effort really came down to answering just a couple of questions:

  • Was I allowed to use the Tableau REST API on the server?
  • Was I willing to try (and fail and learn) something new?

Once both of the above came back yes, everything else was just investing the time, doing research, and trial and error. Thankfully, Tableau has provided excellent documentation and learning resources for their REST API, which helped me to learn what I needed to know. Next up for me is to convert this to a macro for the client team, building on some other recent work I’ve been doing with Alteryx macros (which might be another post).

How about you? Have you tried using Alteryx for a problem like this, or for other Tableau REST API activities? I’d love to hear about it. Drop a note in the comments, or reach to me on Twitter and let’s swap knowledge. Happy solving!

4 thoughts on “Alteryx and the Tableau Server API

  1. Hi Jim, Thank you for the great article about how to do this. It has helped me make some good progress on my own efforts to pull a list of users and groups. Please could you tell me a bit more about the method for using the authorization token (the one you receive in the first download tool) in the second download tool please? i am getting “unauthorized” errors on that step. I obtained a token with the first download, using a Personal Access Token to sign-in, so i have the token value parsed out of the initial response. That part works. In Postman, i can hard code the token into a URL and get the list of users i’m after, but i cannot get the alteryx workflow to generate the correct syntax for the submission. I can’t see this in Postman either, so i’m just stuck. I tried using the header and payload aspects of the download tool, and i also tried using the formula tool to construct a complete URL which the download tool could just submit. I am not sure if i only need the token, or if i need everything in the tag returned by the first download tool. I also don’t know the order or syntax of whatever fields are required… the Tableau REST API documentation give examples in CURL format, but they include spaces in the strings, nested quote marks, etc… Thanks again for your work in summarising how you did this. If you can help me understand this challenge, i would be most appreciative. For ref, my formula tool is using this syntax: “[siteID/users?-X GET -H X-Tableau-Auth:”+[token]

    Thank you!


    1. Hi David,
      Thanks for reading! It looks like you are on the right track overall. A couple of things that I can share from my workflow that might help.

      When I call the URL in the download tool, I am only sending the core URL (without the API commands). So “[siteID/users”

      To send the X-Tableau-Auth token, I configured the Headers tab in the Download tool. In the upper section, add a row with the Name of “X-Tableau-Auth”, and in the lower section pull that value from your field list (where you’ve parsed the value). Alteryx will take those 2 inputs and create a command similar to what you have above.

      That’s how my workflow is configured. Hopefully that gets you back on track!

      Good luck!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s