Working with Tableau APIs: A Comprehensive Guide

By: Published: November 11, 2021

Tableau APIs | Hevo Data

With businesses immensely relying on effective data-driven decision-making for chalking out future strategies, Data Analysis and Business Intelligence have become an integral part of any growth strategy. Business Intelligence tools allow organizations to visualize their data in the form of dashboards, enabling them to derive meaningful insights and maximize revenue outcomes. BI tools connect with other data sources and platforms using API like many enterprises use Tableau APIs to get access data in Databases and SaaS applications.

There are numerous Business Intelligence tools that are available in the market today. One of the most well-known tools is Tableau which is used by almost all departments in a business including Product, Marketing, and even Finance. Along with the ability to create interactive visualizations, Tableau gives users the ability to change Tableau Server, Tableau Online site, and Prep Conductor resources programmatically, using Tableau APIs. The Tableau APIs houses functionality that gives users access to Data Sources, Workbooks, Projects, Users, Sites, etc.

This article will provide you with an in-depth understanding of the various operations that you can perform using Tableau APIs.

Table of Contents

What is Tableau?

Tableau is one of the most powerful and fastest-growing Data Visualization and Business Intelligence tools available in the market. It allows users to seamlessly transform raw data into a visual format that can be understood by anyone.

The various tiers offered by Tableau are as follows:

  • Tableau Desktop
  • Tableau Public
  • Tableau Online
  • Tableau Server
  • Tableau Reader

Tableau is widely used as it allows users to analyze the required data seamlessly. Visualizations in Tableau are generated as Worksheets, Dashboards, and Stories. Users can create custom dashboards that provide actionable insights and help drive the business forward. When configured with the proper underlying hardware and operating systems, all products by Tableau always operate in virtualized environments. Tableau can be used to explore data with limitless visualizations.

What are the Key Features of Tableau?

Some of the key features of Tableau are as follows:

  • Data Sources: Tableau offers seamless integration with a large number of widely used platforms for data storage such as File Systems like Microsoft Excel, CSV, etc., Relational Databases like Microsoft SQL Server, Oracle, IBM DB2, etc., Cloud-based Systems such as Google BigQuery, Windows Azure, etc., or other sources such as ODBC/JDBC.
  • Attractive Visualizations: Tableau gives users the ability to create different types of data visualizations. For example, users can easily create the simplest visualizations such as a Pie Chart or Bar Chart or some of the most complex visualizations such as Bullet Chart, Gantt Chart, Boxplot, etc. Tableau also comes with information on geographical data such as Countries, Cities, Postal Codes, etc. that allows users to build visualizations using informative maps.
  • Wildcard Union and Cross-Data Join: Users have the ability to perform Cross-Data Join and Union in Tableau. This helps in removing the barriers and time-consuming workarounds that were required due to the massive use of numerous data sources.
  • Cross-Data Source Filtering: For data with common dimensions, Tableau gives users the ability to perform the filter operation across multiple data sources at the same time. This also results in all necessary edits or changes being made to all worksheets with the same data sources using the same set of filters automatically.
  • Mobile Dashboards: Tableau allows users to format all their Reports and Dashboards in such a manner that it is compatible with mobile devices as well. It lets users create custom mobile layouts for their Reports or Dashboard specific to their device.

Simplify Tableau ETL Using Hevo’s No-code Data Pipeline

Hevo is a No-code Data Pipeline that offers a fully-managed solution to set up data integration from 100+ data sources including Tableau and will let you directly load data to a Data Warehouse, a Business Intelligence tool such as Tableau, or the destination of your choice. 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.

Let’s Look at Some Salient Features of Hevo:

  • Fully Managed: It requires no management and maintenance as Hevo is a fully automated platform.
  • Data Transformation: It provides a simple interface to perfect, modify, and enrich the data you want to transfer. 
  • 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.
  • 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.

Explore more about Hevo by signing up for the 14-day trial today!

What is the Need for Tableau APIs?

Organizations that use Tableau for Business Analytics will at some point want to embed Tableau Reports and Dashboards into their internal Web Applications that the decision-makers will refer to make decisions. In other cases, they may want to automate repetitive tasks or integrate Tableau tasks into their existing workflows. 

Tableau APIs are the solution for achieving all such integrations. Tableau APIs are intended for developers to integrate Tableau functionality into their Web Applications or easily create third-party Client Applications. 

Prerequisites for using Tableau APIs

  • Administrator access to Tableau Server or Online
  • Basic understanding of Rest APIs.

Working with Tableau APIs

You will now look into some of the common tasks that can be accomplished using Tableau APIs. You will be using an open-source utility called CURL to make the requests. The Tableau APIs can be used to perform the following operations:

1) Signing-in and Authenticating using Tableau APIs

  • Step 1: The first step is to create an XML file with your credentials as shown below.
<tsRequest>
	<credentials name="user-name" password="password">
		<site contentUrl="my-site-name" />
	</credentials>
</tsRequest>
  • Step 2: Execute the below request using CURL to sign in.
curl "https://your-server/api/3.4/auth/signin" -X POST -d "@signin.xml"

The response will be as below if you have succeeded.

<tsResponse xmlns="http://tableau.com/api"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://tableau.com/api
	http://tableau.com/api/ts- api-3.4.xsd">
		<credentials token="fDgkilu12345rdftyuSg|0CHx3E9Sird1werdtyu78Kz">
			<site id="bfdgsg" contentUrl=""/>
			<user id="cvfgtyuh-84c8-418e-9b33-43c0rtyghu8a"/>
		</credentials>
</tsResponse>

The important part here is the credentials token that needs to be saved for all further requests. From the next request onwards, this token must be passed with the attribute name as X-Tableau-Auth. 

2) Creating a Project using Tableau APIs

  • Step 1: To create a project, you should first create an XML file with the project details as follows.
<tsRequest>
	<project
	  name="new-project-name"
	  description="This is a new project" />
</tsRequest>
  • Step 2: You can then use CURL to create a project using a POST request. This is done as below.
curl "https://your-server/api/api-version/sites/site-id/projects" -X POST -H "X-Tableau-Auth:fDgkilu12345rdftyuSg|0CHx3E9Sird1werdtyu78Kz" -d "@create-project.xml"

The response will be as follows:

<tsResponse xmlns="http://tableau.com/api"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://tableau.com/api
  http://tableau.com/api/ts-api-3.4.xsd">
	<project id="124214-4141-sgdsgsg-41414"
	  name="your-project-name"
	  description="description for the project”
	  createdAt="2021-06-07T12:31:58Z"
	  updatedAt="2021-06-07T12:31:58Z"
	  contentPermissions="ManagedByOwner">
		<owner id="aafafa-fafaf-fafaf-1134"/>
		</project>
</tsResponse>

Ensure that the project ID from this response is noted for future use.

3) Listing the Projects on your Site

This requires you to have access to your site ID which is available in the success response received in the initial sign-in request. 

Form the URL as below and execute the following request using CURL. Ensure that the site ID part is replaced with your own site ID.

curl "https://your-server/api/3.4/sites/c7b3099d-9e6d-44f1-8e05-d58d7fa97d4d/projects" -X GET -H "X-Tableau-Auth:fDgkilu12345rdftyuSg|0CHx3E9Sird1werdtyu78Kz"

4) Publishing a Workbook using Tableau APIs

You will now learn how to publish a workbook through the API. In most organizations, this is a very common task that is usually automated based on approval flows. To achieve this, you will need the name of the workbook that has to be published.

  • Step 1: Create an XML file with the name of the workbook as shown below. Save it as publish-wb.xml. 
<tsRequest>
	<workbook name="test_publish" showTabs="true" >
		<project id="124214-4141-sgdsgsg-41414"/>
	</workbook>
</tsRequest>
  • Step 2: Execute the CURL request as below.
curl "https://your-serve/api/3.4/sites/site-id/workbooks" -X POST -H "X-Tableau-Auth:fDgkilu12345rdftyuSg|0CHx3E9Sird1werdtyu78Kz" -H "Content-Type: multipart/mixed;" -F "request_payload=@publish-wb.xml" -F "tableau_workbook=@MY_PUBLISHED_WORKBOOK.twbx"

More information on Tableau APIs can be found here

Conclusion

This article provided you with a basic understanding of the various operations that be performed using Tableau APIs. Tableau provides a rich set of APIs that allows one to manage everything from user permissions and groups to workbook management. All the APIs follow the general pattern as the ones shown above. 

Tableau APIs is another aspect of what makes Tableau one of the most preferred Business Intelligence tools in the industry. Tableau’s intuitive visualizations and advanced analytical abilities allow even people without a technical background to make the most of their data. 

If at all, there is something that prevents an organization from getting the best out of Tableau, it is the lack of direct integration with some of the popular Cloud-based services. To solve that problem, businesses can use automated Data Integration platforms like Hevo.

Hevo helps you directly transfer data from a source of your choice to a Data Warehouse, Business Intelligence tools such as Tableau, etc., or desired destination in a fully automated and secure manner without having to write the code. It will make your life easier and make data migration hassle-free. It is User-Friendly, Reliable, and Secure.

Details on Hevo pricing can be found here. Give Hevo a try by signing up for the 14-day free trial today.

mm
Former Director of Product Management, Hevo Data

Vivek Sinha has extensive experience in real-time analytics and cloud-native technologies. With a focus on Apache Pinot, he was a driving force in shaping innovation and defensible differentiators, including enhanced query processing, data mutability support, and cost-effective tiered storage solutions at Hevo. He also demonstrates a passion for exploring and implementing innovative trends within the dynamic data industry landscape.

Visualize your Data in Tableau in Real-time Easily