REST API: Publish Workbook, Initiate File Upload, Append to File Upload. For information on these content permissions, see Lock Content Permissions to the Project. # Create an interval to run every 2 hours between 2:30AM and 11:00PM, # Create a daily interval to run every day at 12:30AM, # Create schedule item using daily interval, # Create a weekly interval to run every Monday, Wednesday, and Friday at 7:15PM, # Create schedule item using weekly interval, # Create a monthly interval to run on the 15th of every month at 11:30PM, # Create schedule item using monthly interval, # change the REST API version to match the server, # or change the REST API version to match a specific version The value can be. Use the. Removes the specified data source from Tableau Server. See, Access the server views and methods. Returns the list of views items for a site. If you program in Python, you can also use the Tableau Server Client (TSC), a Python library for the Tableau Server REST API. Queries the server and returns information about the workbooks the site. The preview image is added to view_item and can be accessed by its preview_image field. Raises an error if the datasource_item is unspecified. The method uses the view.id and workbook.id to identify the preview image. See. To set the daily interval, you create an instance of the, Runs the scheduled item once a week. The PDF content is added to the view_item and can be accessed by its pdf field. The value must be an integer between, The type of page returned in PDF format for the view. Specifies the user to subscribe, the content to subscribe to, the schedule to associate the subscription with, and the subject, or description for the subscription. This should be a, (Boolean) Determines whether to embed the password (, (Boolean) Determines whether to embed the passowrd (, (Boolean) Specifies whether OAuth is used for the data source of workbook connection. Use these values to iterate through the results. Returns a list of all ProjectItem objects and a PaginationItem. Returns information about the workbooks that the specified user owns and has Read (view) permissions for. ... sms, tel, tsc, and tsl are allowed (safe listed) by default. Returns all the data sources for the site. Specifies the id (not the name) of the user to sign in as. (Optional) Additional request options to send to the endpoint. The target of the subscription, that is, the content that is subscribed to (view, workbook). All rights reserved. The TSC library provides a method to access the build and version information from Tableau Server. If no location is specified (the default is, (Optional) Specifies whether to download the file with the extract. The Server class contains the attributes that represent the server on Tableau Server. The Tableau Server Client provides several methods for interacting with user resources, or endpoints. # The example runs in Python 2.7 and Python 3.3 code import requests, json # NOTE! The name of the data source as it would appear in a URL. The REST API is designed to return only the information you ask for explicitly. Using the TSC library, you can get information about all the users on a site, and you can add or remove users, or update user information. Specifies the direction to sort the returned fields. This is the description that you provide to identify the subscription. Use this class to specify the format of the PDF that is returned for the view. For Tableau Online, you also specify the auth_setting attribute in your request. Using the TSC library, you can manage and change many of the Tableau Server and Tableau Online resources programmatically. Using the TSC library, you can manage and change many of the Tableau Server and Tableau Online resources programmatically. : Raises an error if the group_item is unspecified. The RequestOptions.Field class corresponds to the fields used in filter expressions in the Tableau REST API. To call this method, create a server object for your server. For more information, see Filtering and Sorting in the Tableau REST API. Many of the calls that you make with the TSC library query for resources (like workbooks or data sources) on Tableau Server. © 2003-2020 Tableau Software LLC. Raises an error of the file path is incorrect or if the file is missing. The site item that you want to update. The maximum number of minutes the image will be cached on the server before being refreshed. When the image is generated, the specified filters will be applied to the view. See, Access the user resources and methods. (Optional) You can pass the method a request object that contains additional parameters to filter the request. The options are either, The id of the parent project. A Boolean value that indicates whether the data source is certified. This is a list of ConnectionItem. For user-based license, the maximum number of users is set by the license. To add a new user to the site you need to first create a new user_item (from UserItem class). Query projects, sites, and more. These jobs can be created when Tableau runs certain tasks that could be long running, such as importing or synchronizing users from Active Directory, or running an extract refresh. Returns a list of GroupItem objects and a PaginationItem object. Use this method to retrieve the connections. You must populate connections before you can iterate through the Extract API. See the TableauAuth class. The user resources for Tableau Server are defined in the UserItem class. Returns all schedule items from the server. unless you package the data and workbook in a .twbx file, or publish the data source separately. In an effort to learn about a few concepts relevant to Tableau Server and automation, we're going to build the following: a Python script that uses Tableau Server's REST API, webhooks and a library called HTTPServer, to post to Slack.The resulting application is based on the premise of posting a notification to Slack when a new workbook is published to Tableau Server. See, Access the resources and methods for projects. Source files: server/endpoints/subscriptions_endpoint.py. Specifies the properties for the project. The maximum number of minutes the CSV data will be cached on the server before being refreshed. Return a list of project items for a site. (Optional) This attribute is only for Tableau Online. You can also use the provided Pager generator to get all views on site, without having to page through the results. For more information, see, Determines if a data source allows use of Ask Data. If unspecified, the, Optional. Data source name cannot be updated. The options are Overwrite, Append, or CreateNew. Note: The REST API cannot automatically include See. For example, if you were searching for a specific workbook, you could specify the name of the workbook or the name of the owner. The new authentication type for the user. # first get all users, call server.users.get() The job methods are based upon the endpoints for jobs in the REST API and operate on the JobItem class. This endpoint is available with REST API version 2.7 and up. # import tableauserverclient as TSC Project is now {1}". Populates the PDF content of the specified view. The project resources for Tableau are defined in the ProjectItem class. Shows the specific build number (for example, 10200.17.0329.1446). After you add a user, Tableau Online sends the user an email invitation. The connection information is updated with the information in the ConnectionItem. You can also get and update information about the scheduled tasks, or delete scheduled tasks. Use this method to retrieve the views. TSC. # in this case, id of the workbook and the target type "workbook", # create the new subscription to the site, # import tableauserverclient as TSC For an example of using the TSC library and the Hyper API to publish a single-table .hyper file, see the sample code Publishing a Single Table Hyper File to Tableau Online, Tableau Server. Tableauâs TSC library favors XML. For information about managing projects, project hierarchies, and permissions, see. The WorkbookItem. Create custom scripts that pull your data into Tableau data extracts. ALL RIGHTS RESERVED, # call the sign-in method with the auth object, # find and then switch auth to another site on the same server, # Create new datasource_item with project id '3a8b6148-493c-11e6-a621-6f3499394a39', # server = TSC.Server('https://SERVERURL') Note: When working with Tableau Online, you must use the HTTPS protocol to make API calls. Benefits: If you can connect to your data, you can use the Extract API to create data extracts that improve performance and provide offline access. The optional note that describes the certified data source. # server = TSC.Server('https://MY-SERVER') The Tableau Server Client (TSC) is a Python library for the Tableau Server REST API. The date and time when the data source was created. Create custom scripts that pull your data into Tableau data extracts. None. This command can contain multiple comma and space-separated values, as in this example: tsm configuration set -k vizqlserver.url_scheme_whitelist -v scheme1, ⦠# sign in ... # call the refresh method with the data source item, # call the update method with the data source item, # Adding a user to a group These methods correspond to endpoints in the Tableau Server REST API. When the workbook has an extract, if you set the parameter. (Optional) You can pass in request options to specify the maximum age of the CSV cached on the server. The project methods are based upon the endpoints for projects in the REST API and operate on the ProjectItem class. To create a project, you first create a new instance of a ProjectItem and pass it to the create method. Source file: server/endpoint/views_endpoint.py. a .twb file that uses data from an Excel or csv file on a local computer cannot be published, Publish a workbook to the specified site. Source file: models/personal_access_token_auth.py. The script might have benefited from using TSC (Tableau Server Client) for a more structured approach, though Iâm not sure yet how the token would then have been used for the subsequent requests to the Metadata API after logging in to the REST API. Content tagged with python api on tableau, api rest. See SubscriptionItem class. Check the code for the reference # This example shows how to use the Tableau Server REST API # to sign in to a server, get back an authentication token and # site ID, and then sign out. See, (Optional) You can pass in request options to specify the page type and orientation of the PDF content, as well as the maximum age of the PDF rendered on the server. View Filters Benefits: If you can connect to your data, you can use the Extract API to create data extracts that improve performance and provide offline access. Source files: server/endpoint/jobs_endpoint.py. See views.populate_pdf. The identifier associated with the specific subscription. The credentials for signing in are defined in the TableauAuth class and they correspond to the attributes you specify when you sign in using the Tableau Server REST API. Use Cases: Connect to data sources with the Hyper API and write the data into extract files (in the .hyper file format for Tableau 10.5 and later). The site methods are based upon the endpoints for sites in the REST API and operate on the SiteItem class. Set pagination options This method retrieves the connection information for the specified data source. Use Cases: Integrate user management of Tableau Server with the user management of the embedding application. Source file: server/endpoint/groups_endpoint.py. Source files: server/endpoints/subscription_item.py. These methods correspond to endpoints or methods for sites in the Tableau REST API. Optionally, you can specify the maximum age of the CSV data cached on the server by providing a maxage value. The date and time when the workbook was last updated. Tableau Server Client (Python) The Tableau Server Client is a Python library for the Tableau Server REST API. The schedule methods are based upon the endpoints for schedules in the REST API and operate on the ScheduleItem class. The TSC API reference is organized by resource. With the TSC library you can do almost everything that you can do with the REST API, including: Publish workbooks and data sources. The TSC library provides a Filter class that you can use to filter results returned from the server. A list of ConnectionItem objects are added to the data source (datasource_item.connections). Display the REST API version The API gives you simple access to the functionality behind the data sources, projects, workbooks, site users, and sites on a Tableau server. These methods correspond to endpoints in the Tableau Server REST API. The SiteItem class defines the information you can request or query from Tableau Server or Tableau Online. See the TableauAuth class. See what other developers and partners have built in the Tableau⦠The options are LockedToProject and ManagedByOwner. Raises an error if the ID of the view is missing. The PersonalAccessTokenAuth class serves the same purpose and is used in the same way as TableauAuth, but using Personal Access Tokens](https://help.tableau.com/current/server/en-us/security_personal_access_tokens.htm) instead of username and password. The project ID is sent to the server as part of the URI. # create auth, specify site The Schedule methods are based upon the endpoints for jobs in the REST API and operate on the JobItem class. You must run the populate_workbooks method to add the workbooks to the, The name of the user. The name of the site. I am not a tableau server admin. The class corresponds to the view resources you can access using the Tableau Server REST API. Raises an error if the datasource_item is unspecified. Users can manage permissions for content that they own. Raises an error if an name is not specified. The file path to the downloaded data source. The value to compare with the specified field and operator. The value must be an integer between, The type of task. To specify the site to create the new project, create a TableauAuth instance using the content URL for the site (site_id), and sign in to that site. If you set a quota and the site exceeds it, publishers will be prevented from uploading new content until the site is under the limit again. See, Access the resources and methods for subscriptions. If you do not specify this value, the limit depends on the type of licensing configured for the server. Optionally, you can specify the maximum age of the rendered PDF that is cached on the server by providing a maxage value. Returns a list of DatasourceItem objects and a PaginationItem object. This method uses the id field to query the CSV data, and populates the data as the csv field. Suggestions and pull requests are welcome on our GitHub page. For information about the server object, see Server. The class corresponds to the properties for jobs you can access using the Tableau Server REST API. See, Access the groups resources and methods. This class sets the frequency and start time of the scheduled item. The class members correspond to the attributes of a server response payload. Populates (or gets) a list of views for a workbook. Using the TSC library, you can schedule extract refresh or subscription tasks on Tableau Server. Publishes a data source to a server, or appends data to an existing data source. ⦠This endpoint is available with REST API version 3.4 and up. Source file: server/endpoint/sites_endpoint.py. Using the TSC library, you can get information about an asynchronous process (or job) on the server. You can use the Filter and RequestOptions classes to filter and sort the following endpoints: For more information, see Filter and Sort. Using the TSC library, you can get information about all the groups on a site, you can add or remove groups, or add or remove users in a group. The extract is tied to a data source on Amazon Athena. The workbooks the user owns. The. Itâs an open source project managed by Tableau that wraps around the Tableau Server REST API. Use these values to iterate through the results. The id of the site that you want to delete. Export PDF with python and TSC Francesco Di Francesco Mar 17, 2020 6:30 AM Hi guys i'm trying to export a dashboard as pdf using TSC but I find it difficult to apply the code you can find in tableau guide. Switching avoids the need for reauthenticating to the same server. Sets the field to sort on. # sign in, get a specific view, etc. The REST API is designed to return only the information you ask for explicitly. The view methods are based upon the endpoints for views in the REST API and operate on the ViewItem class. Tableau Server Client (Python) Use the Tableau Server Client (TSC) library to increase your productivity as you interact with the Tableau Server REST API. Creates a new schedule for an extract refresh or a subscription. The sign_out() method takes care of invalidating the authentication token. Specify. The usage statistics for the view. Tableau Server Client (TSC) library (Python 3.5 or later) Probably the best option out there for performing server related tasks from a Python script. The project resources for Tableau are defined in the WorkbookItem class. On Tableau Server, the default is 25. Returns information about the specified subscription. The PDF content is added to the workbook_item and can be accessed by its pdf field. Raises an error if an id is not specified. With the TSC library you can do almost everything that you can do with the REST API, including: Publish workbooks and data sources. Tableau has an ever-growing list of Application Programming Interfaces (APIs) that we as developers can leverage to add functionality to Tableau; personally speaking, this is the most exciting part of the Tableau ecosystem. See the update_connection.py sample in the Samples directory. The fields are defined in the, The direction to sort, either ascending (. To set the hourly interval, you create an instance of the, Runs the scheduled item daily. These methods correspond to endpoints in the Tableau Server REST API. Tableau releases a new API version every quarter or so but the docs do not depict which features are available in which version Let's look at some code that can be used to query your Tableau metadata. You can use the Sort and RequestOptions classes to filter and sort the following endpoints: You can use the ImageRequestOptions and PDFRequestOptions to set options for views returned as images and PDF files. Using the TSC library, you can get information about views in a site or a workbook. Updates the server address, port, username, or password for the specified data source connection. When you create an instance of the Server class, you have access to the resources on the server after you sign in. Downloads the specified data source in .tdsx or .hyper format. The Pager generator. # sign in, etc. When you add user to Tableau Online, the name of the user must be the email address that is used to sign in to Tableau Online. Source file: server/endpoint/datasources_endpoint.py. Deletes a workbook with the specified ID. Using the Tableau Server REST API, you can manage and change Tableau Server resources programmatically, via HTTP. The site item object must include the site ID and overrides all other settings. The data source is downloaded in .tdsx or .hyper format. LEGAL PRIVACY © 2003–document.write(new Date().getFullYear()) TABLEAU SOFTWARE LLC. The GroupItem class defines the information you can request or query from Tableau Server. # tableau_auth sign in, etc. You must first call the. An easy way to pass XML is to create it in a text file and then reference the text file in the cURL command by using the -d option. The method populates the preview_image for the view. Raises an error if the ID for the view item or workbook is missing. For core-based licensing, there is no limit to the number of users. The Tableau Server Client provides two methods for interacting with authentication resources. The date and time the user last logged in. For more information, see Tableau Server Client (Python) (Link opens in a new window) on GitHub. None. Using the TSC library, you can get information about all the projects on a site, or you can create, update projects, or remove projects. The CSV data is added to the view_item and can be accessed by its csv field. To specify the site, create a TableauAuth instance using the content URL for the site (site_id), and sign in to that site. In the Tableau Server REST API, there are separate endpoints to query and update workbook and data source connections. See workbooks.populate_connections. ... metadata-api-samples / samples / metadata-api-with-python-and-TSC.py Go to file Go to file T; Go to line L; Copy path Cannot retrieve contributors at this time. The data source methods are based upon the endpoints for data sources in the REST API and operate on the DatasourceItem class. If you program in Python, you can also use the Tableau Server Client (TSC), a Python library for the Tableau Server REST API. You can use this access to create your own custom applications or to script interactions with Tableau Server resources. # import tableauserverclient as TSC Populates a preview image for the specified view. An updated UserItem. Returns a list of SubscriptionItem objects and a PaginationItem object. You can use the vf('filter_name', 'filter_value') method to add view filters.