Why we need this ?
...
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 TokenName,TokenSecret and paste
...
them into
...
2 new environment
...
variables called TableauTokenName,TableauTokenSecret
on Windows
on Linux
run nano .my.cshrc and add variable
Code Block setenv TableauTokenName "myToken..." setenv TableauTokenSecret "123456..."
...
Code Block |
---|
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
Code Block session.siteItems("dataAlerts").filter(it => ((it \ "@frequency").text) == "daily").map(da => (da \ "@subject", da \ "@frequency", da \ "@suspended")).foreach(println)
...