How to hit the Tableau API

Tableau's REST API lives on your Tableau Cloud pod or Server at /api/3.29. Sign in first; the response's credentials.token goes in X-Tableau-Auth on every later call, and it includes your site id. Send Accept: application/json or you'll get XML.

Authentication

Create a personal access token under My Account Settings in Tableau. {{TABLEAU_HOST}} is your pod, like 10ax.online.tableau.com; {{SITE_CONTENT_URL}} is the site name in your URLs.

Full reference: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api.htm

Sign in with a personal access token

curl -X POST https://{{TABLEAU_HOST}}/api/3.29/auth/signin \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"credentials": {"personalAccessTokenName": "{{PAT_NAME}}", "personalAccessTokenSecret": "{{PAT_SECRET}}", "site": {"contentUrl": "{{SITE_CONTENT_URL}}"}}}'
Run in PostTaco

List workbooks

curl https://{{TABLEAU_HOST}}/api/3.29/sites/{{SITE_ID}}/workbooks \
  -H "X-Tableau-Auth: {{TABLEAU_TOKEN}}" \
  -H "Accept: application/json"
Run in PostTaco

List views

curl https://{{TABLEAU_HOST}}/api/3.29/sites/{{SITE_ID}}/views \
  -H "X-Tableau-Auth: {{TABLEAU_TOKEN}}" \
  -H "Accept: application/json"
Run in PostTaco