With the Tableau Server REST API you can manage and change Tableau Server, Tableau Online site, and Prep Conductor resources programmatically, using HTTP. The API gives you simple access to the functionality behind Tableau data sources, projects, workbooks, site users, sites, flows, and more. You can use this access to create your own custom applications or to script interactions with Tableau resources.
When you work with the Tableau Server REST API, you use the following HTTP verbs to request actions from the server:
The HTTP verb indicates the type of operation you want to perform on a resource. You indicate what resource to work with by making requests using a URI. The URI specifies the site, project, workbook, user, or other resource that you are creating, viewing, or deleting. For example, to get a list of the users in a specific group, you send a GET request that has the following format:
In this URI, your-server is the name or IP address for your Tableau Server installation, api-version is the api version bumber, The site-id value is an identifier for the site, and group-id is an ID for the group.
The request block can be in either XML or JSON. By default, the Content-Type is (text/xml). If you use XML, the block must have root element called <tsRequest>. The body of the XML request might look like the following:
If you set the Content-Type to JSON (application/json), the request block might look like the following:
The siteRole value is the role you want the new user to have, such as Viewer, Publisher, or Interactor. In response to the POST request to create a user, Tableau Server returns the response that includes the user-id assigned to the new user.
To update a user, you make a PUT request and use a URI like the following to update the user with the specific user-id:
In XML, the body of the request might look like this:
<user fullName="Adam Davis"
Or like the following in JSON:
"fullName": "Adam Davis",
The XML and JSON requests and responses follow a schema. You can use the XML schema to generate classes that you can use when programming.
REST API methods that require data in the body of the request pass the data as an XML block. In addition, many API methods return data in the response using an XML block.
The schema for the XML used in requests and response is available in a schema (.xsd) file. When you construct XML for a request, you must make sure that the XML block is well formed and that it conforms to the schema. For many programming frameworks, you can generate code from the .xsd file that maps XML elements and attributes to objects and properties. You can use this code to help you create XML blocks using typed code, and to deserialize and serialize data from REST API requests and responses.
You can download the lastest schema as an .xsd file from the following locations:
Version 3.12 (Tableau Server 2021.2): ts-api_3_12.xsd
© 2023 Digcode.com