Tableau REST API allows you to manage and modify the Tableau Online site, Tableau Server, and Prep Conductor Resources programmatically with the help of HTTP. The API provides simple access to the functionality behind Tableau projects, site users, workbooks, data sources, flows, sites, and so much more.

This blog provides a detailed insight into REST API Tableau, including its key features, benefits, use cases, and importance. It then talks about the two methods you can use to connect Tableau to REST API. You will learn in depth about autonomous REST Connector and a third-party tool, Hevo Data

Let’s get started!

What is Tableau?

Tableau REST API : Tableau logo | Hevo Data
Image Source

Tableau, a leading data visualization and business intelligence tool, is designed to be user-friendly. It transforms raw data into insightful and interactive visual reports. Its intuitive interface, robust capabilities, and wide range of features make it a favorite among data analysts, business users, and decision-makers, providing ease and comfort in their data analysis tasks.

Key Features of Tableau

Tableau is a powerful tool and is widely used by a lot of industries. To understand Tableau better let’s look at some of its key features:

  • Tableau Accelerators: Tableau provides the accelerator feature to build ready-to-use dashboards that you can combine with your data and customize to fit your needs. They help you get to data-driven insights faster.
  • Bins: Tableau provides Bins as a feature that helps group continuous data into discrete intervals, simplifying complex datasets into easily interpretable patterns. This feature makes it easier for users to visualize and analyze data through histograms and other distribution displays.
  • Cataloging: Tableau automatically catalogs all your data assets and sources into one central list and provides metadata in context for fast data discovery.
  • Dynamic Dashboards: Tableau’s dashboards are interactive and dynamic, enabling users to filter data, drill down into details, and explore different perspectives of their data interactively.
  • Predictive models: Tableau allows analysts to create predictive models native to the platform. With the help of native predictive modeling, you can make a model that understands how your data is distributed around any trend line.

What is REST API?

REST API stands for Representational State Transfer, which presents some constraints of the REST architecture style. An HTTP request is used to access and use the data with commands such as PUT, GET, DELETE, POST, etc. 

A REST API, basically defines how different applications communicate over HTTP.  These different components remain loosely coupled and the transfer of information is fast and carried out efficiently. Since data formats aren’t defined, it serves a more diverse purpose and is easier to develop. Thus, REST APIs are a popular choice among web developers and have emerged as the standard protocol for web-based APIs.

The REST architecture can be understood as follows:

Tableau REST API - REST API Architecture | Hevo Data
Image Source

What is Tableau REST API?

Tableau REST API: API Reference | Hevo Data
Image Source

You can use Tableau REST API to script interactions with Tableau resources and create your custom applications. It offers multiple methods for your convenience such as:

  • Flow Methods: Flow Methods allow you to add, download, query, run and delete flows, flow permissions, and flow tasks to schedule.
  • Metrics Methods: With Metric Methods you can get, update or delete metrics easily. You can even list metrics by the site through this method.
  • Projects Methods: With these methods, you can easily query, create, delete, or update projects.
  • Publishing Methods: Publishing Methods can help you publish flows, workbooks, or data sources. It can also allow you to append or initiate a file upload.
  • Site Methods: There are a couple of Site Methods that allow you to create, delete, query, and update a site.
  • Revisions Methods: These methods allow you to obtain, download or remove data source revisions or workbook revisions.

The Tableau REST API is based on the principles of REST (Representational State Transfer) protocol for Client-Server communication. The Client-server communication occurs over HTTP, for the Tableau Server using standard web requests.

While working with the Tableau REST API, you can use the following HTTP verbs to request actions from the server:

  • PUT: This HTTP verb can be used to update existing resources, such as updating permissions, updating a user’s password, or changing a workbook owner.
  • POST: You can use this verb to publish or create new resources, such as users, data sources, sites, and workbooks.
  • DELETE: It can be used to remove a resource, for instance, deleting a workbook or user. It can also be used to dissociate a resource from a collection. For instance, if you use DELETE to remove a user from a site, which dissociates the user from the collection of users on the website, but doesn’t remove the user from the server. 
  • GET: You can use GET to read information, such as downloading a workbook or getting a list of users.
Tableau REST API: Description | Hevo Data
Image Source

What are the use cases of Tableau REST API?

The Tableau Server REST API allows you to manage and modify Tableau Server, Tableau Online sites, and Prep Conductor resources programmatically using HTTP. APIs provide easy access to features such as Tableau data sources, projects, workbooks, site users, sites, streams, and more. You can use this access to create your own custom applications or scripts to interact with Tableau resources. The following are the top four use cases of Tableau REST API:

  1. You can integrate user management of Tableau Server with the user management of the embedding application.
  2. With the help of Tableau REST API, one can manage server content and permissions based on the application’s state.
  3. One can query Server metadata using Tableau REST API, so the right information is displayed to your user.
  4. It helps in automating the management of Tableau Server amongst many other applications.
Integrate REST API to BigQuery
Integrate Salesforce to Snowflake
Integrate Webhooks to Redshift

Tableau REST API Example

Example, here you can see the illustration of how to access Tableau API in Python.

How To Access Tableau API in Python

You can get information from a user by using the Tableau API URI. The URI identifies the site, project, workbook, user, or other resources that are being retrieved, added, updated, or deleted. The GET HTTP method will be used to retrieve records from the server. An example of URI syntax is as follows:

https://your-server/api/3.5/sites/site-id/groups/group-id/users

The URI holds the following information:

  • your-server: This is the name or IP address of your Tableau Server.
  • site-id: It contains the value of the site identifier.
  • group-id: This is the group’s identifier.

 The site, groups, and other resources are represented by 16 hexadecimal value in the fllowing format: 9a8b7c6d5-e4f3-a2b1-c0d9-e8f7a6b5c4d.

1) Install Python dependency

To handle HTTP requests in this application, you will use the requests package. The following command will install the request and flask packages:

pip install requests
pip install flask

2) Get Tableau Site Users

Create a file by the name of tableu.py and add the below code to this file. You can get data using tableau API.

from flask import Flask
from flask_restful import Resource, Api
from flask_cors import CORS
import requests

app = Flask(__name__)
CORS(app) ## To allow direct AJAX calls

@app.route('/getGroups', methods=['GET'])
def home():
   try:        
    headers = {'Tableau-Auth': 'tableau token', 'Content-Type': 'application/json'}
    url = "https://your-server/api/3.5/sites/site-id/groups/group-id/users";
    res = requests.get(url, headers=headers)

    return r.json()

   except Exception as e:
    print('unable to get groups.')
    print(e.strerror)

if __name__ == '__main__':
   app.run(debug = True)

How to Set up Tableau REST API Integration?

Here are the different methods you can follow to set up Tableau Server REST API Integration in a seamless fashion:

Method 1: Using Autonomous REST Connector for Tableau REST API Integration

Here are the steps you can follow to establish a REST API Tableau connection using an Autonomous REST Connector:

Step 1: Download and Install the Autonomous REST Connector

  • Install and download the Autonomous REST Connector for ODBC. Next, you need to install the connector by running the setup executable file.
    If you don’t have the Tableau-supported driver downloaded yet, click this link.

Step 2: Authenticating Data Source

  • Here, we’ll be using HubSpot as an example data source. HubSpot gives you two means of authentication- API Keys and OAuth. Autonomous REST Connector provides support for both methods. Here, you will be leveraging API Keys for authentication. Here is an instance of the request using the API key:
curl https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=456****cfa 

Step 3: Create the ODBC Data Source

  • Open ODBC Administrator (64-bit) and create a new data source by clicking on the Add button.
  • Select DataDirect 8.0 Autonomous REST Connector as the driver for this step.
Tableau REST API: Create New Data Source Window | Hevo Data
Image Source
  • On the configuration window, give a name to the data source and under REST Sample Path, paste the endpoint you wish to connect to. Suppose, you want to connect to the Get All Companies endpoint, you just have to paste that endpoint in the REST Sample Path as follows:
Tableau REST API: Progress DataDirect Autonomous REST Connector for ODBC Setup | Hevo Data
Image Source
  • Navigate to the Authentication tab and set the parameters as follows:
Tableau REST API: Setting the Parameters | Hevo Data
Image Source
  • Click on the Test Connect button in the previous step to establish a connection to the API.

Step 4: Connect from Tableau

  • In this step, you need to connect to the data source from Tableau. In Tableau, select Other Databases (ODBC), and select HubSpot as the sample DSN you just created.
Tableau REST API: Other Databases | Hevo Data
Image Source
  • Now you can see a list of tables made available through the Autonomous REST Connector. It does this by normalizing the JSON response from the API. Next, you need to access the REST API data as usual.
Tableau REST API: List of Tables in Autonomous REST Connector | Hevo Data
Image Source

Step 5: Connecting to Multiple Endpoints

  • To configure multiple endpoints for Autonomous REST Connector, you need to create a new file called <Data Source Name>.rest and configure the endpoints as shown below, and save the file:
Tableau REST API: Connecting to Multiple Endpoints | Hevo Data
Image Source
  • Open the ODBC Administrator and clear the REST Sample Path in the DSN Configuration you have created. Next, under the REST Config File, navigate to the configuration file <Data Source Name>.rest as shown below:
Tableau REST API: Clear REST Sample Path | Hevo Data
Image Source
  • Click on Test Connect to check if the connection has been established successfully. Next, open Tableau and refresh the connection. You will be able to see more tables that are normalized from the API by Autonomous REST Connector.
Tableau REST API: Test Connect | Hevo Data
Image Source
  • You can then choose to Extract Data or use a Live Connection to request data from REST API on the go with the help of an Autonomous REST Connector.

A few limitations of this method are as follows:

  • It is not as well-documented as the native Tableau REST API connectors. The Autonomous REST Connector is not as well-documented as the native Tableau REST API connectors. This means that it can be more difficult to use, and you may have to rely on community forums and other resources to find the information you need.
  • It is not as reliable as the native Tableau REST API connectors. The Autonomous REST Connector is not as reliable as the native Tableau REST API connectors. This means that you may experience connection issues or data loss when using this tool.
  • It does not support all of the features of the native Tableau REST API connectors. The Autonomous REST Connector does not support all of the features of the native Tableau REST API connectors. This means that you may not be able to use all of the features of Tableau when using this tool.

Method 2: Using Hevo for REST API Integration

Hevo is a No-code Data Pipeline. It supports pre-built data integrations from 150+ data sources such as REST APIs. Hevo offers a fully managed solution for your fully automated pipeline to set up the REST API integration and will let you directly stream data to Tableau from a REST API.

It will automate your data flow in minutes without writing any line of code. Its fault-tolerant architecture makes sure that your data is secure and consistent. Hevo provides you with a truly efficient and fully automated solution to manage data in real-time and always have analysis-ready data at Tableau.

Now you can transfer data from REST API to your target BI tool like Tableau for Free using Hevo!

Hevo focuses on three simple steps to get you started

  • Connect: Connect Hevo with REST API and various other data sources by simply logging in with your credentials/providing the correct end-point.
  • Integrate: Consolidate your customer data from several sources in Hevo’s Fully- Managed Google BigQuery-based Data Warehouse and automatically transform it into an analysis-ready form.
  • Visualize: Connect Hevo with Tableau and easily visualize your unified payments and sales data to gain better insights.

As can be seen, you are simply required to enter the corresponding credentials to implement this fully automated data pipeline without using any code.

The detailed documentation of the functionality offered can be found here.

Let’s look at some salient features of Hevo

  • Fully Managed: It requires no management and maintenance as Hevo is a fully automated platform.
  • Real-Time: Hevo offers real-time data migration. So, your data is always ready for analysis.
  • Schema Management: Hevo can automatically detect the schema of the incoming data and maps it to the destination schema.
  • 100% Complete & Accurate Data Transfer: Hevo’s robust infrastructure ensures reliable data transfer with zero data loss.
  • Scalable Infrastructure: Hevo has in-built integrations for 150+ sources that can help you scale your data infrastructure as required.
  • Live Monitoring: Advanced monitoring gives you a one-stop view to watch all the activities that occur within pipelines.
  • Live Support: Hevo team is available round the clock to extend exceptional support to its customers through chat, email, and support calls.
  • Transformations: Hevo provides preload transformations through Python code. It also allows you to run transformation code for each event in the Data Pipelines you set up. You need to edit the event object’s properties received in the transform method as a parameter to carry out the transformation. Hevo also offers drag and drop transformations like Date and Control Functions, JSON, and Event Manipulation to name a few. These can be configured and tested before putting them to use.
  • Connectors: Hevo supports 150+ integrations to SaaS platforms, files, databases, analytics, and BI tools. It supports various destinations including Amazon Redshift, Snowflake Data Warehouses; Amazon S3 Data Lakes; and MySQL, SQL Server, TokuDB, DynamoDB, PostgreSQL databases to name a few.  

Explore more about Hevo by signing up for a 14-day free trial today.

Additional Resources on Tableau Rest API

Conclusion

This blog talks about the different methods you can use to connect REST API to Tableau in a seamless fashion, using Autonomous REST Connector and with the help of a No-code Data Pipeline, Hevo Data. It also gives a brief introduction to Tableau Server REST API. This includes a brief overview of the various methods enlisted under the Tableau Server REST API.

Hevo provides a No-Code Data Pipeline that allows accurate and real-time replication of data from 150+ sources of data such as REST APIs straight to your desired destination/BI Tool such as Tableau.  

FAQ on Tableau Server REST API

What is the Tableau Rest API?

The Tableau REST API is a comprehensive interface that allows developers to interact programmatically with Tableau Server or Tableau Online. It offers tools for controlling and automating various administrative procedures and tasks of Tableau users, sites, and materials.

Can Tableau connect to Rest APIs?

Yes, Tableau can connect to REST APIs, but it doesn’t natively support REST APIs as a direct data source. Instead, you can use several methods to bring REST API data into Tableau.

How to enable Tableau Rest API?

The Tableau REST API is enabled by default on Tableau Server and Tableau Online. However, to use it effectively, you must ensure that you have the appropriate permissions and follow some basic steps to authenticate and make API calls.

Can we create a site using the Rest API in Tableau?

Yes, you can create a site using the Tableau REST API in Tableau.

mm
Content Marketing Manager, Hevo Data

Amit is a Content Marketing Manager at Hevo Data. He is passionate about writing for SaaS products and modern data platforms. His portfolio of more than 200 articles shows his extraordinary talent for crafting engaging content that clearly conveys the advantages and complexity of cutting-edge data technologies. Amit’s extensive knowledge of the SaaS market and modern data solutions enables him to write insightful and informative pieces that engage and educate audiences, making him a thought leader in the sector.

No-code Data Pipeline for Tableau