Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Current »

Why we need this ?

For quite some time tabcmd has been Tableau’s swiss-army-knife for all kinds of tasks (external extracts, publishing, etc). It is a Windows cmd-tool so the only way to use it was writing Windows-batch scripts 😟.

Last couple of years a new tool has emerged - Tableau Rest API - which is continuously beefed up by Tableau. It’s worth giving it a try.

This trend - moving towards Rest APIs - can be seen all across the industry. For example Jira also have their Rest API which allows to communicate and administer Jira programatically using virtually any language of your choice.

Rest API is build around web calls (GET, POST, etc), a lot of curling. This approach is OK but sometimes feels awkward that’s why I have built a Scala wrapper which hinds all sharp edges (authentication, XML-parsing, parameters, etc) and let’s you write straightforward Scala scripts 🤓.

Say “hello” to our TableauRestAPI Scala-wrapper

How to use it ?

Generate Personal Access Token in your Tableau profile

Copy your TokenSecret and paste it into a new environment variable called TableauTokenSecret

  • on Windows

  • on Linux

    • run nano .my.cshrc and add variable

    • setenv TableauTokenSecret "123456..."

ssh-connect to “analytics” server

Run “~analytics/TigerETL3/runEtlShell.sh

Establish new session to Tableau REST API

import analytics.tiger.agents.TableauRestAPI._
val session = signin("https://tableau.broadinstitute.org/api/3.6","myToken")

Examples:

  • lookup extractRefreshId by Workbook name

    • session.lookupExtractRefreshTaskId("Array QC Tesy Extract With REST_API")

  • print out first 5 items from extracts-list

    • session.siteItems("tasks/extractRefreshes", "tasks").take(5).foreach(println)

  • print out dataAlerts having daily-frequency

    • session.siteItems("dataAlerts").filter(it => ((it \ "@frequency").text) == "daily").map(da => (da \ "@subject", da \ "@frequency", da \ "@suspended")).foreach(println)

  • No labels