├── .gitignore ├── LICENSE ├── README.md ├── java ├── .classpath ├── .project ├── README.md ├── ant.properties ├── build.xml ├── ivy.xml ├── res │ ├── World Indicators-En-US.twbx │ └── config.properties └── src │ └── com │ └── tableausoftware │ └── documentation │ └── api │ └── rest │ ├── Demo.java │ ├── bindings │ ├── CapabilityType.java │ ├── ErrorType.java │ ├── FileUploadType.java │ ├── GranteeCapabilitiesType.java │ ├── GroupListType.java │ ├── GroupType.java │ ├── ObjectFactory.java │ ├── PaginationType.java │ ├── ParentType.java │ ├── PermissionsType.java │ ├── ProjectListType.java │ ├── ProjectType.java │ ├── SiteListType.java │ ├── SiteRoleType.java │ ├── SiteType.java │ ├── TableauCredentialsType.java │ ├── TagListType.java │ ├── TagType.java │ ├── TsRequest.java │ ├── TsResponse.java │ ├── UserType.java │ ├── ViewListType.java │ ├── ViewType.java │ ├── WorkbookListType.java │ ├── WorkbookType.java │ └── package-info.java │ └── util │ └── RestApiUtils.java ├── postman ├── Postman-Collection-Tableau-Webhooks.json ├── Postman-Environment-Tableau-Webhooks.json └── README.md └── python ├── README.md ├── move_datasource_server.py ├── move_workbook_projects.py ├── move_workbook_server.py ├── move_workbook_sites.py ├── publish_workbook.py ├── update_permission.py ├── user_permission_audit.py ├── users_by_group.py ├── version.py └── webhooks.py /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # java dirs 3 | **/build 4 | **/lib 5 | 6 | # python files 7 | *.pyc 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Tableau 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # rest-api-samples 3 | [![Tableau Supported](https://img.shields.io/badge/Support%20Level-Tableau%20Supported-53bd92.svg)](https://www.tableau.com/support-levels-it-and-developer-tools) 4 | 5 | This repository contains Python and Java samples for the Tableau REST API, as well as [Postman collections](https://www.postman.com/) that can be called against the REST API. For instructions on running the samples, see the Readme files in each directory. 6 | 7 | Other references 8 | - [Developer docs for the REST API](http://onlinehelp.tableau.com/current/api/rest_api/en-us/help.htm). 9 | - [Tableau python library for the REST API](https://github.com/tableau/server-client-python) (includes samples showing how to use the library) 10 | - [Samples for the Metadata API](https://github.com/tableau/metadata-api-samples) 11 | 12 | Getting Started 13 | --------------- 14 | 15 | * Clone this repository. 16 | * Select the version of the REST API that you want to use. The API version corresponds to the version of Tableau Server that you use. 17 | For more information, see [API Versions in the documentation](http://onlinehelp.tableau.com/current/api/rest_api/en-us/help.htm#REST/rest_api_concepts_versions.htm). You will have to configure the samples to use the API version that you select. 18 | * Try the samples against your Tableau Server or Tableau Online. 19 | * Use 'Issues' to note any bugs or to request new samples. 20 | * Let us know if you have samples of your own you'd like to share. 21 | 22 | Note: the Java samples are written for Java 8, and will not run against Java 11 or Java 13. We do plan to update them, but if you send a PR that would also be welome! 23 | -------------------------------------------------------------------------------- /java/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /java/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | tab-documentation-api 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.ui.externaltools.ExternalToolBuilder 10 | full,incremental, 11 | 12 | 13 | LaunchConfigHandle 14 | <project>/.externalToolBuilders/New_Builder.launch 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | 22 | 23 | -------------------------------------------------------------------------------- /java/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Requirements 3 | 4 | * Tableau Server 5 | * Java SDK 8 6 | * Download: 7 | * Apache Ant 8 | * It is not neccessary to run the "Optional" steps in the Apache Ant guide. 9 | * Download: 10 | * Apache Ivy 11 | * Download: 12 | * For installation instructions, see the readme file included in the download. 13 | 14 | ## Getting started 15 | 16 | 1. Install the tools listed in the "Requirements" section. 17 | 1. Download the REST API schema and save it in the `/res` folder under the folder where this README file is. For more information about the schema, see the following documentation: 18 | 19 | 20 | 21 | 1. In the `/res` folder, open the `config.properties` file using a text editor. 22 | 1. Modify the configurations as instructed in the file. A sample workbook is already provided with this sample, but you can use any packaged workbook that you want. 23 | 1. Open the following file in a text editor: 24 | 25 | ``` 26 | src\com\tableausoftware\documentation\api\rest\util\RestApiUtils.java 27 | ``` 28 | 29 | 1. Find the `getApiUriBuilder()` method, and replace the API URL with the correct version number. 30 | 31 | For example, you might see the following URL: 32 | 33 | ``` 34 | /api/3.5/ 35 | ``` 36 | 37 | If you want to use version 3.4 of the API, replace the URL with the following: 38 | 39 | ``` 40 | /api/3.4/ 41 | ``` 42 | 43 | ## Running the sample 44 | 45 | 1. Make sure that Tableau Server is running. 46 | 1. Open a command prompt or terminal. 47 | 1. In the command prompt window, change directory to the sample code's parent folder. 48 | 1. Enter `ant` in the command prompt to compile the sample code and download dependencies. 49 | 1. Enter `ant run` in the command prompt to run the sample code after compilation. 50 | 51 | ## Possible problems 52 | 53 | When `ant` is run in a command prompt, it may respond with "ant is not recognized as an internal or external command..." 54 | 55 | Make sure that the `ANT_HOME` and `JAVA_HOME` variables are set as described in the installation guide for Apache Ant. Paths should not include quotes. 56 | For more information, see 57 | -------------------------------------------------------------------------------- /java/ant.properties: -------------------------------------------------------------------------------- 1 | # Properties specific to this project 2 | src.dir = ${basedir}/src 3 | build.dir = ${basedir}/build 4 | classes.dir = ${build.dir}/classes 5 | jar.dir = ${build.dir}/jar 6 | lib.dir = ${basedir}/lib 7 | main-class = "com.tableausoftware.documentation.api.rest.Demo" 8 | -------------------------------------------------------------------------------- /java/build.xml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /java/ivy.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /java/res/World Indicators-En-US.twbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tableau/rest-api-samples/7bcfe8d61ea7696d0e87d20f050d7b7d21b76643/java/res/World Indicators-En-US.twbx -------------------------------------------------------------------------------- /java/res/config.properties: -------------------------------------------------------------------------------- 1 | # Set this to the name or IP address of the Tableau Server installation. 2 | server.host=http://YOUR-SERVER 3 | 4 | # Set where the REST API schema is located 5 | # The latest schema can be downloaded from here: 6 | # http://onlinehelp.tableau.com/current/api/rest_api/en-us/help.htm#REST/rest_api_concepts_schema.htm 7 | server.schema.location=res/ts-api_X_X.xsd 8 | 9 | # Set this to the content URL of the default site. 10 | # Not assigning a value to this configuration references the default site. 11 | site.default.contentUrl= 12 | 13 | # Set the username and password to use for the example. 14 | # Note that for most tasks, the user must be a system administrator. 15 | user.admin.name=admin 16 | user.admin.password=passw0rd 17 | 18 | # Set the name and path of the workbook to publish 19 | workbook.sample.name=World Indicators 20 | workbook.sample.path=res/World Indicators-En-US.twbx 21 | 22 | # Set whether the workbook should be published in chunks or not 23 | workbook.publish.chunked=true 24 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/Demo.java: -------------------------------------------------------------------------------- 1 | package com.tableausoftware.documentation.api.rest; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.IOException; 6 | import java.util.ArrayList; 7 | import java.util.HashMap; 8 | import java.util.List; 9 | import java.util.Map; 10 | import java.util.Properties; 11 | 12 | import org.apache.log4j.BasicConfigurator; 13 | import org.apache.log4j.Logger; 14 | 15 | import com.tableausoftware.documentation.api.rest.bindings.GranteeCapabilitiesType; 16 | import com.tableausoftware.documentation.api.rest.bindings.GroupType; 17 | import com.tableausoftware.documentation.api.rest.bindings.ProjectListType; 18 | import com.tableausoftware.documentation.api.rest.bindings.ProjectType; 19 | import com.tableausoftware.documentation.api.rest.bindings.TableauCredentialsType; 20 | import com.tableausoftware.documentation.api.rest.bindings.WorkbookType; 21 | import com.tableausoftware.documentation.api.rest.util.RestApiUtils; 22 | 23 | /** 24 | * This class demonstrates how to make Tableau REST API calls. It first gets 25 | * some required values from the configuration file, including the credentials 26 | * for a system administrator to authenticate as, and the name or IP address of the 27 | * server to sign in to. The code then makes REST API calls to perform these 28 | * tasks: 29 | * 30 | * 1. Sign in to the server ("Sign In" method). 31 | * 2. Get a list of projects ("Query Projects" method). 32 | * 3. Get the ID of the current project, which is the default project. 33 | * 4. Publish a workbook ("Publish Workbook"). 34 | * 5. Create a group on the server ("Create Group" method). 35 | * 6. Set permissions for the group on the published workbook ("Add Workbook Permissions" method). 36 | * 7. Get a list of workbooks that the current user can read ("Query Workbooks For User" method). 37 | * 8. Sign out ("Sign Out" method). 38 | */ 39 | public class Demo { 40 | 41 | private static Logger s_logger = Logger.getLogger(Demo.class); 42 | 43 | private static Properties s_properties = new Properties(); 44 | 45 | private static final RestApiUtils s_restApiUtils = RestApiUtils.getInstance(); 46 | 47 | static { 48 | // Configures the logger to log to stdout 49 | BasicConfigurator.configure(); 50 | 51 | // Loads the values from configuration file into the Properties instance 52 | try { 53 | s_properties.load(new FileInputStream("res/config.properties")); 54 | } catch (IOException e) { 55 | s_logger.error("Failed to load configuration files."); 56 | } 57 | } 58 | 59 | public static void main(String[] args) { 60 | // Sets the username, password, and content URL, which are all required 61 | // in the payload of a Sign In request 62 | String username = s_properties.getProperty("user.admin.name"); 63 | String password = s_properties.getProperty("user.admin.password"); 64 | String contentUrl = s_properties.getProperty("site.default.contentUrl"); 65 | 66 | // Signs in to server and saves the authentication token, site ID, and current user ID 67 | TableauCredentialsType credential = s_restApiUtils.invokeSignIn(username, password, contentUrl); 68 | String currentSiteId = credential.getSite().getId(); 69 | String currentUserId = credential.getUser().getId(); 70 | 71 | s_logger.info(String.format("Authentication token: %s", credential.getToken())); 72 | s_logger.info(String.format("Site ID: %s", currentSiteId)); 73 | 74 | // Queries the projects on the current site and iterates over the list to 75 | // find the ID of the default project 76 | ProjectType defaultProject = null; 77 | ProjectListType projects = s_restApiUtils.invokeQueryProjects(credential, currentSiteId); 78 | for (ProjectType project : projects.getProject()) { 79 | if (project.getName().equals("default") || project.getName().equals("Default")) { 80 | defaultProject = project; 81 | 82 | s_logger.info(String.format("Default project found: %s", defaultProject.getId())); 83 | } 84 | } 85 | 86 | // Ensure the default project was found before attempting to use it; if it was not found, 87 | // log the failure and exit gracefully 88 | if (defaultProject == null) 89 | { 90 | s_logger.error("Failed to find default project"); 91 | 92 | // Signs out of the server. This invalidates the authentication token so 93 | // that it cannot be used for more requests. 94 | s_restApiUtils.invokeSignOut(credential); 95 | 96 | s_logger.info("Exiting without publishing due to previous failure"); 97 | return; 98 | } 99 | 100 | // Sets the name to assign to the workbook to be published 101 | String workbookName = s_properties.getProperty("workbook.sample.name"); 102 | 103 | // Gets the workbook file to publish 104 | String workbookPath = s_properties.getProperty("workbook.sample.path"); 105 | File workbookFile = new File(workbookPath); 106 | 107 | // Gets whether or not to publish the workbook using file uploads 108 | boolean chunkedPublish = Boolean.valueOf(s_properties.getProperty("workbook.publish.chunked")); 109 | 110 | // Publishes the workbook as a multipart request 111 | WorkbookType publishedWorkbook = s_restApiUtils.invokePublishWorkbook(credential, currentSiteId, 112 | defaultProject.getId(), workbookName, workbookFile, chunkedPublish); 113 | 114 | // Creates a non Active Directory group named "TableauExample" 115 | GroupType group = s_restApiUtils.invokeCreateGroup(credential, currentSiteId, "TableauExample"); 116 | 117 | // Sets permission to allow the group to read the new workbook, but not 118 | // to modify its permissions 119 | Map capabilities = new HashMap(); 120 | capabilities.put("Read", "Allow"); 121 | capabilities.put("ChangePermissions", "Deny"); 122 | 123 | // Creates the grantee capability element for the group 124 | GranteeCapabilitiesType groupCapabilities = s_restApiUtils.createGroupGranteeCapability(group, capabilities); 125 | 126 | // Adds the created group to the list of grantees 127 | List granteeCapabilities = new ArrayList(); 128 | granteeCapabilities.add(groupCapabilities); 129 | 130 | // Makes the call to add the permissions 131 | s_restApiUtils.invokeAddPermissionsToWorkbook(credential, currentSiteId, publishedWorkbook.getId(), 132 | granteeCapabilities); 133 | 134 | // Gets the list of workbooks the current user can read 135 | List currentUserWorkbooks = s_restApiUtils.invokeQueryWorkbooks(credential, currentSiteId, 136 | currentUserId).getWorkbook(); 137 | 138 | // Checks whether the workbook published previously is in the list, then 139 | // checks whether the workbook's owner is the current user 140 | for (WorkbookType workbook : currentUserWorkbooks) { 141 | if (workbook.getId().equals(publishedWorkbook.getId())) { 142 | s_logger.debug(String.format("Published workbook found: %s", workbook.getId())); 143 | 144 | if (workbook.getOwner().getId().equals(currentUserId)) { 145 | s_logger.debug("Published workbook was published by current user"); 146 | } 147 | } 148 | } 149 | 150 | // Signs out of the server. This invalidates the authentication token so 151 | // that it cannot be used for more requests. 152 | s_restApiUtils.invokeSignOut(credential); 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/CapabilityType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.01.30 at 12:49:43 PM PST 6 | // 7 | 8 | 9 | package com.tableausoftware.documentation.api.rest.bindings; 10 | 11 | import javax.xml.bind.annotation.XmlAccessType; 12 | import javax.xml.bind.annotation.XmlAccessorType; 13 | import javax.xml.bind.annotation.XmlAttribute; 14 | import javax.xml.bind.annotation.XmlType; 15 | 16 | 17 | /** 18 | *

Java class for capabilityType complex type. 19 | * 20 | *

The following schema fragment specifies the expected content contained within this class. 21 | * 22 | *

 23 |  * <complexType name="capabilityType">
 24 |  *   <complexContent>
 25 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 26 |  *       <attribute name="name" use="required">
 27 |  *         <simpleType>
 28 |  *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 29 |  *             <enumeration value="AddComment"/>
 30 |  *             <enumeration value="ChangeHierarchy"/>
 31 |  *             <enumeration value="ChangePermissions"/>
 32 |  *             <enumeration value="Connect"/>
 33 |  *             <enumeration value="Delete"/>
 34 |  *             <enumeration value="ExportData"/>
 35 |  *             <enumeration value="ExportImage"/>
 36 |  *             <enumeration value="ExportXml"/>
 37 |  *             <enumeration value="Filter"/>
 38 |  *             <enumeration value="ProjectLeader"/>
 39 |  *             <enumeration value="Read"/>
 40 |  *             <enumeration value="ShareView"/>
 41 |  *             <enumeration value="ViewComments"/>
 42 |  *             <enumeration value="ViewUnderlyingData"/>
 43 |  *             <enumeration value="WebAuthoring"/>
 44 |  *             <enumeration value="Write"/>
 45 |  *           </restriction>
 46 |  *         </simpleType>
 47 |  *       </attribute>
 48 |  *       <attribute name="mode" use="required">
 49 |  *         <simpleType>
 50 |  *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 51 |  *             <enumeration value="Allow"/>
 52 |  *             <enumeration value="Deny"/>
 53 |  *           </restriction>
 54 |  *         </simpleType>
 55 |  *       </attribute>
 56 |  *     </restriction>
 57 |  *   </complexContent>
 58 |  * </complexType>
 59 |  * 
60 | * 61 | * 62 | */ 63 | @XmlAccessorType(XmlAccessType.FIELD) 64 | @XmlType(name = "capabilityType") 65 | public class CapabilityType { 66 | 67 | @XmlAttribute(name = "name", required = true) 68 | protected String name; 69 | @XmlAttribute(name = "mode", required = true) 70 | protected String mode; 71 | 72 | /** 73 | * Gets the value of the name property. 74 | * 75 | * @return 76 | * possible object is 77 | * {@link String } 78 | * 79 | */ 80 | public String getName() { 81 | return name; 82 | } 83 | 84 | /** 85 | * Sets the value of the name property. 86 | * 87 | * @param value 88 | * allowed object is 89 | * {@link String } 90 | * 91 | */ 92 | public void setName(String value) { 93 | this.name = value; 94 | } 95 | 96 | /** 97 | * Gets the value of the mode property. 98 | * 99 | * @return 100 | * possible object is 101 | * {@link String } 102 | * 103 | */ 104 | public String getMode() { 105 | return mode; 106 | } 107 | 108 | /** 109 | * Sets the value of the mode property. 110 | * 111 | * @param value 112 | * allowed object is 113 | * {@link String } 114 | * 115 | */ 116 | public void setMode(String value) { 117 | this.mode = value; 118 | } 119 | 120 | } 121 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/ErrorType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.01.30 at 12:49:43 PM PST 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import java.math.BigInteger; 11 | 12 | import javax.xml.bind.annotation.XmlAccessType; 13 | import javax.xml.bind.annotation.XmlAccessorType; 14 | import javax.xml.bind.annotation.XmlAttribute; 15 | import javax.xml.bind.annotation.XmlElement; 16 | import javax.xml.bind.annotation.XmlSchemaType; 17 | import javax.xml.bind.annotation.XmlType; 18 | 19 | /** 20 | *

21 | * Java class for errorType complex type. 22 | * 23 | *

24 | * The following schema fragment specifies the expected content contained within 25 | * this class. 26 | * 27 | *

 28 |  * <complexType name="errorType">
 29 |  *   <complexContent>
 30 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 31 |  *       <sequence>
 32 |  *         <element name="summary" type="{http://www.w3.org/2001/XMLSchema}string"/>
 33 |  *         <element name="detail" type="{http://www.w3.org/2001/XMLSchema}string"/>
 34 |  *       </sequence>
 35 |  *       <attribute name="code" use="required" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
 36 |  *     </restriction>
 37 |  *   </complexContent>
 38 |  * </complexType>
 39 |  * 
40 | * 41 | * 42 | */ 43 | @XmlAccessorType(XmlAccessType.FIELD) 44 | @XmlType(name = "errorType", propOrder = { "summary", "detail" }) 45 | public class ErrorType { 46 | 47 | @XmlElement(required = true) 48 | protected String summary; 49 | @XmlElement(required = true) 50 | protected String detail; 51 | @XmlAttribute(name = "code", required = true) 52 | @XmlSchemaType(name = "positiveInteger") 53 | protected BigInteger code; 54 | 55 | /** 56 | * Gets the value of the summary property. 57 | * 58 | * @return possible object is {@link String } 59 | * 60 | */ 61 | public String getSummary() { 62 | return summary; 63 | } 64 | 65 | /** 66 | * Sets the value of the summary property. 67 | * 68 | * @param value 69 | * allowed object is {@link String } 70 | * 71 | */ 72 | public void setSummary(String value) { 73 | this.summary = value; 74 | } 75 | 76 | /** 77 | * Gets the value of the detail property. 78 | * 79 | * @return possible object is {@link String } 80 | * 81 | */ 82 | public String getDetail() { 83 | return detail; 84 | } 85 | 86 | /** 87 | * Sets the value of the detail property. 88 | * 89 | * @param value 90 | * allowed object is {@link String } 91 | * 92 | */ 93 | public void setDetail(String value) { 94 | this.detail = value; 95 | } 96 | 97 | /** 98 | * Gets the value of the code property. 99 | * 100 | * @return possible object is {@link BigInteger } 101 | * 102 | */ 103 | public BigInteger getCode() { 104 | return code; 105 | } 106 | 107 | /** 108 | * Sets the value of the code property. 109 | * 110 | * @param value 111 | * allowed object is {@link BigInteger } 112 | * 113 | */ 114 | public void setCode(BigInteger value) { 115 | this.code = value; 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/FileUploadType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.02.17 at 01:46:22 PM PST 6 | // 7 | 8 | 9 | package com.tableausoftware.documentation.api.rest.bindings; 10 | 11 | import java.math.BigInteger; 12 | 13 | import javax.xml.bind.annotation.XmlAccessType; 14 | import javax.xml.bind.annotation.XmlAccessorType; 15 | import javax.xml.bind.annotation.XmlAttribute; 16 | import javax.xml.bind.annotation.XmlSchemaType; 17 | import javax.xml.bind.annotation.XmlType; 18 | 19 | 20 | /** 21 | *

Java class for fileUploadType complex type. 22 | * 23 | *

The following schema fragment specifies the expected content contained within this class. 24 | * 25 | *

26 |  * <complexType name="fileUploadType">
27 |  *   <complexContent>
28 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
29 |  *       <attribute name="uploadSessionId" use="required" type="{http://tableau.com/api}fileUploadSessionIdType" />
30 |  *       <attribute name="fileSize" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" />
31 |  *     </restriction>
32 |  *   </complexContent>
33 |  * </complexType>
34 |  * 
35 | * 36 | * 37 | */ 38 | @XmlAccessorType(XmlAccessType.FIELD) 39 | @XmlType(name = "fileUploadType") 40 | public class FileUploadType { 41 | 42 | @XmlAttribute(name = "uploadSessionId", required = true) 43 | protected String uploadSessionId; 44 | @XmlAttribute(name = "fileSize") 45 | @XmlSchemaType(name = "nonNegativeInteger") 46 | protected BigInteger fileSize; 47 | 48 | /** 49 | * Gets the value of the uploadSessionId property. 50 | * 51 | * @return 52 | * possible object is 53 | * {@link String } 54 | * 55 | */ 56 | public String getUploadSessionId() { 57 | return uploadSessionId; 58 | } 59 | 60 | /** 61 | * Sets the value of the uploadSessionId property. 62 | * 63 | * @param value 64 | * allowed object is 65 | * {@link String } 66 | * 67 | */ 68 | public void setUploadSessionId(String value) { 69 | this.uploadSessionId = value; 70 | } 71 | 72 | /** 73 | * Gets the value of the fileSize property. 74 | * 75 | * @return 76 | * possible object is 77 | * {@link BigInteger } 78 | * 79 | */ 80 | public BigInteger getFileSize() { 81 | return fileSize; 82 | } 83 | 84 | /** 85 | * Sets the value of the fileSize property. 86 | * 87 | * @param value 88 | * allowed object is 89 | * {@link BigInteger } 90 | * 91 | */ 92 | public void setFileSize(BigInteger value) { 93 | this.fileSize = value; 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/GranteeCapabilitiesType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.01.30 at 12:49:43 PM PST 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | import javax.xml.bind.annotation.XmlAccessType; 14 | import javax.xml.bind.annotation.XmlAccessorType; 15 | import javax.xml.bind.annotation.XmlElement; 16 | import javax.xml.bind.annotation.XmlType; 17 | 18 | /** 19 | *

20 | * Java class for granteeCapabilitiesType complex type. 21 | * 22 | *

23 | * The following schema fragment specifies the expected content contained within 24 | * this class. 25 | * 26 | *

 27 |  * <complexType name="granteeCapabilitiesType">
 28 |  *   <complexContent>
 29 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 30 |  *       <sequence>
 31 |  *         <choice>
 32 |  *           <element name="group" type="{http://tableau.com/api}groupType"/>
 33 |  *           <element name="user" type="{http://tableau.com/api}userType"/>
 34 |  *         </choice>
 35 |  *         <element name="capabilities">
 36 |  *           <complexType>
 37 |  *             <complexContent>
 38 |  *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 39 |  *                 <sequence>
 40 |  *                   <element name="capability" type="{http://tableau.com/api}capabilityType" maxOccurs="unbounded"/>
 41 |  *                 </sequence>
 42 |  *               </restriction>
 43 |  *             </complexContent>
 44 |  *           </complexType>
 45 |  *         </element>
 46 |  *       </sequence>
 47 |  *     </restriction>
 48 |  *   </complexContent>
 49 |  * </complexType>
 50 |  * 
51 | * 52 | * 53 | */ 54 | @XmlAccessorType(XmlAccessType.FIELD) 55 | @XmlType(name = "granteeCapabilitiesType", propOrder = { "group", "user", "capabilities" }) 56 | public class GranteeCapabilitiesType { 57 | 58 | protected GroupType group; 59 | protected UserType user; 60 | @XmlElement(required = true) 61 | protected GranteeCapabilitiesType.Capabilities capabilities; 62 | 63 | /** 64 | * Gets the value of the group property. 65 | * 66 | * @return possible object is {@link GroupType } 67 | * 68 | */ 69 | public GroupType getGroup() { 70 | return group; 71 | } 72 | 73 | /** 74 | * Sets the value of the group property. 75 | * 76 | * @param value 77 | * allowed object is {@link GroupType } 78 | * 79 | */ 80 | public void setGroup(GroupType value) { 81 | this.group = value; 82 | } 83 | 84 | /** 85 | * Gets the value of the user property. 86 | * 87 | * @return possible object is {@link UserType } 88 | * 89 | */ 90 | public UserType getUser() { 91 | return user; 92 | } 93 | 94 | /** 95 | * Sets the value of the user property. 96 | * 97 | * @param value 98 | * allowed object is {@link UserType } 99 | * 100 | */ 101 | public void setUser(UserType value) { 102 | this.user = value; 103 | } 104 | 105 | /** 106 | * Gets the value of the capabilities property. 107 | * 108 | * @return possible object is {@link GranteeCapabilitiesType.Capabilities } 109 | * 110 | */ 111 | public GranteeCapabilitiesType.Capabilities getCapabilities() { 112 | return capabilities; 113 | } 114 | 115 | /** 116 | * Sets the value of the capabilities property. 117 | * 118 | * @param value 119 | * allowed object is {@link GranteeCapabilitiesType.Capabilities } 120 | * 121 | */ 122 | public void setCapabilities(GranteeCapabilitiesType.Capabilities value) { 123 | this.capabilities = value; 124 | } 125 | 126 | /** 127 | *

128 | * Java class for anonymous complex type. 129 | * 130 | *

131 | * The following schema fragment specifies the expected content contained 132 | * within this class. 133 | * 134 | *

135 |      * <complexType>
136 |      *   <complexContent>
137 |      *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
138 |      *       <sequence>
139 |      *         <element name="capability" type="{http://tableau.com/api}capabilityType" maxOccurs="unbounded"/>
140 |      *       </sequence>
141 |      *     </restriction>
142 |      *   </complexContent>
143 |      * </complexType>
144 |      * 
145 | * 146 | * 147 | */ 148 | @XmlAccessorType(XmlAccessType.FIELD) 149 | @XmlType(name = "", propOrder = { "capability" }) 150 | public static class Capabilities { 151 | 152 | @XmlElement(required = true) 153 | protected List capability; 154 | 155 | /** 156 | * Gets the value of the capability property. 157 | * 158 | *

159 | * This accessor method returns a reference to the live list, not a 160 | * snapshot. Therefore any modification you make to the returned list 161 | * will be present inside the JAXB object. This is why there is not a 162 | * set method for the capability property. 163 | * 164 | *

165 | * For example, to add a new item, do as follows: 166 | * 167 | *

168 |          * getCapability().add(newItem);
169 |          * 
170 | * 171 | * 172 | *

173 | * Objects of the following type(s) are allowed in the list 174 | * {@link CapabilityType } 175 | * 176 | * 177 | */ 178 | public List getCapability() { 179 | if (capability == null) { 180 | capability = new ArrayList(); 181 | } 182 | return this.capability; 183 | } 184 | 185 | } 186 | 187 | } 188 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/GroupListType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.01.30 at 12:49:43 PM PST 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | import javax.xml.bind.annotation.XmlAccessType; 14 | import javax.xml.bind.annotation.XmlAccessorType; 15 | import javax.xml.bind.annotation.XmlType; 16 | 17 | /** 18 | *

19 | * Java class for groupListType complex type. 20 | * 21 | *

22 | * The following schema fragment specifies the expected content contained within 23 | * this class. 24 | * 25 | *

26 |  * <complexType name="groupListType">
27 |  *   <complexContent>
28 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
29 |  *       <sequence>
30 |  *         <element name="group" type="{http://tableau.com/api}groupType" maxOccurs="unbounded" minOccurs="0"/>
31 |  *       </sequence>
32 |  *     </restriction>
33 |  *   </complexContent>
34 |  * </complexType>
35 |  * 
36 | * 37 | * 38 | */ 39 | @XmlAccessorType(XmlAccessType.FIELD) 40 | @XmlType(name = "groupListType", propOrder = { "group" }) 41 | public class GroupListType { 42 | 43 | protected List group; 44 | 45 | /** 46 | * Gets the value of the group property. 47 | * 48 | *

49 | * This accessor method returns a reference to the live list, not a 50 | * snapshot. Therefore any modification you make to the returned list will 51 | * be present inside the JAXB object. This is why there is not a 52 | * set method for the group property. 53 | * 54 | *

55 | * For example, to add a new item, do as follows: 56 | * 57 | *

58 |      * getGroup().add(newItem);
59 |      * 
60 | * 61 | * 62 | *

63 | * Objects of the following type(s) are allowed in the list 64 | * {@link GroupType } 65 | * 66 | * 67 | */ 68 | public List getGroup() { 69 | if (group == null) { 70 | group = new ArrayList(); 71 | } 72 | return this.group; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/GroupType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.01.30 at 12:49:43 PM PST 6 | // 7 | 8 | 9 | package com.tableausoftware.documentation.api.rest.bindings; 10 | 11 | import javax.xml.bind.annotation.XmlAccessType; 12 | import javax.xml.bind.annotation.XmlAccessorType; 13 | import javax.xml.bind.annotation.XmlAttribute; 14 | import javax.xml.bind.annotation.XmlType; 15 | 16 | 17 | /** 18 | *

Java class for groupType complex type. 19 | * 20 | *

The following schema fragment specifies the expected content contained within this class. 21 | * 22 | *

23 |  * <complexType name="groupType">
24 |  *   <complexContent>
25 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
26 |  *       <sequence>
27 |  *         <element name="domain" type="{http://tableau.com/api}domainDirectiveType" minOccurs="0"/>
28 |  *         <element name="import" type="{http://tableau.com/api}importDirectiveType" minOccurs="0"/>
29 |  *       </sequence>
30 |  *       <attribute name="id" type="{http://tableau.com/api}resourceIdType" />
31 |  *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
32 |  *     </restriction>
33 |  *   </complexContent>
34 |  * </complexType>
35 |  * 
36 | * 37 | * 38 | */ 39 | @XmlAccessorType(XmlAccessType.FIELD) 40 | @XmlType(name = "groupType", propOrder = { 41 | }) 42 | public class GroupType { 43 | 44 | @XmlAttribute(name = "id") 45 | protected String id; 46 | @XmlAttribute(name = "name") 47 | protected String name; 48 | 49 | /** 50 | * Gets the value of the id property. 51 | * 52 | * @return 53 | * possible object is 54 | * {@link String } 55 | * 56 | */ 57 | public String getId() { 58 | return id; 59 | } 60 | 61 | /** 62 | * Sets the value of the id property. 63 | * 64 | * @param value 65 | * allowed object is 66 | * {@link String } 67 | * 68 | */ 69 | public void setId(String value) { 70 | this.id = value; 71 | } 72 | 73 | /** 74 | * Gets the value of the name property. 75 | * 76 | * @return 77 | * possible object is 78 | * {@link String } 79 | * 80 | */ 81 | public String getName() { 82 | return name; 83 | } 84 | 85 | /** 86 | * Sets the value of the name property. 87 | * 88 | * @param value 89 | * allowed object is 90 | * {@link String } 91 | * 92 | */ 93 | public void setName(String value) { 94 | this.name = value; 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/ObjectFactory.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.01.30 at 12:49:43 PM PST 6 | // 7 | 8 | 9 | package com.tableausoftware.documentation.api.rest.bindings; 10 | 11 | import javax.xml.bind.annotation.XmlRegistry; 12 | 13 | 14 | /** 15 | * This object contains factory methods for each 16 | * Java content interface and Java element interface 17 | * generated in the com.tableausoftware.documentation.api.rest.bindings package. 18 | *

An ObjectFactory allows you to programatically 19 | * construct new instances of the Java representation 20 | * for XML content. The Java representation of XML 21 | * content can consist of schema derived interfaces 22 | * and classes representing the binding of schema 23 | * type definitions, element declarations and model 24 | * groups. Factory methods for each of these are 25 | * provided in this class. 26 | * 27 | */ 28 | @XmlRegistry 29 | public class ObjectFactory { 30 | 31 | 32 | /** 33 | * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.tableausoftware.documentation.api.rest.bindings 34 | * 35 | */ 36 | public ObjectFactory() { 37 | } 38 | 39 | /** 40 | * Create an instance of {@link GranteeCapabilitiesType } 41 | * 42 | */ 43 | public GranteeCapabilitiesType createGranteeCapabilitiesType() { 44 | return new GranteeCapabilitiesType(); 45 | } 46 | 47 | /** 48 | * Create an instance of {@link SiteType } 49 | * 50 | */ 51 | public SiteType createSiteType() { 52 | return new SiteType(); 53 | } 54 | 55 | /** 56 | * Create an instance of {@link TsResponse } 57 | * 58 | */ 59 | public TsResponse createTsResponse() { 60 | return new TsResponse(); 61 | } 62 | 63 | /** 64 | * Create an instance of {@link TableauCredentialsType } 65 | * 66 | */ 67 | public TableauCredentialsType createTableauCredentialsType() { 68 | return new TableauCredentialsType(); 69 | } 70 | 71 | /** 72 | * Create an instance of {@link GroupType } 73 | * 74 | */ 75 | public GroupType createGroupType() { 76 | return new GroupType(); 77 | } 78 | 79 | /** 80 | * Create an instance of {@link PermissionsType } 81 | * 82 | */ 83 | public PermissionsType createPermissionsType() { 84 | return new PermissionsType(); 85 | } 86 | 87 | /** 88 | * Create an instance of {@link ProjectType } 89 | * 90 | */ 91 | public ProjectType createProjectType() { 92 | return new ProjectType(); 93 | } 94 | 95 | /** 96 | * Create an instance of {@link WorkbookType } 97 | * 98 | */ 99 | public WorkbookType createWorkbookType() { 100 | return new WorkbookType(); 101 | } 102 | 103 | /** 104 | * Create an instance of {@link TsRequest } 105 | * 106 | */ 107 | public TsRequest createTsRequest() { 108 | return new TsRequest(); 109 | } 110 | 111 | /** 112 | * Create an instance of {@link CapabilityType } 113 | * 114 | */ 115 | public CapabilityType createCapabilityType() { 116 | return new CapabilityType(); 117 | } 118 | 119 | /** 120 | * Create an instance of {@link GranteeCapabilitiesType.Capabilities } 121 | * 122 | */ 123 | public GranteeCapabilitiesType.Capabilities createGranteeCapabilitiesTypeCapabilities() { 124 | return new GranteeCapabilitiesType.Capabilities(); 125 | } 126 | 127 | } 128 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/PaginationType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.01.30 at 12:49:43 PM PST 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import java.math.BigInteger; 11 | 12 | import javax.xml.bind.annotation.XmlAccessType; 13 | import javax.xml.bind.annotation.XmlAccessorType; 14 | import javax.xml.bind.annotation.XmlAttribute; 15 | import javax.xml.bind.annotation.XmlSchemaType; 16 | import javax.xml.bind.annotation.XmlType; 17 | 18 | /** 19 | *

20 | * Java class for paginationType complex type. 21 | * 22 | *

23 | * The following schema fragment specifies the expected content contained within 24 | * this class. 25 | * 26 | *

 27 |  * <complexType name="paginationType">
 28 |  *   <complexContent>
 29 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 30 |  *       <attribute name="pageNumber" use="required" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
 31 |  *       <attribute name="pageSize" use="required" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" />
 32 |  *       <attribute name="totalAvailable" use="required" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" />
 33 |  *     </restriction>
 34 |  *   </complexContent>
 35 |  * </complexType>
 36 |  * 
37 | * 38 | * 39 | */ 40 | @XmlAccessorType(XmlAccessType.FIELD) 41 | @XmlType(name = "paginationType") 42 | public class PaginationType { 43 | 44 | @XmlAttribute(name = "pageNumber", required = true) 45 | @XmlSchemaType(name = "positiveInteger") 46 | protected BigInteger pageNumber; 47 | @XmlAttribute(name = "pageSize", required = true) 48 | @XmlSchemaType(name = "nonNegativeInteger") 49 | protected BigInteger pageSize; 50 | @XmlAttribute(name = "totalAvailable", required = true) 51 | @XmlSchemaType(name = "nonNegativeInteger") 52 | protected BigInteger totalAvailable; 53 | 54 | /** 55 | * Gets the value of the pageNumber property. 56 | * 57 | * @return possible object is {@link BigInteger } 58 | * 59 | */ 60 | public BigInteger getPageNumber() { 61 | return pageNumber; 62 | } 63 | 64 | /** 65 | * Sets the value of the pageNumber property. 66 | * 67 | * @param value 68 | * allowed object is {@link BigInteger } 69 | * 70 | */ 71 | public void setPageNumber(BigInteger value) { 72 | this.pageNumber = value; 73 | } 74 | 75 | /** 76 | * Gets the value of the pageSize property. 77 | * 78 | * @return possible object is {@link BigInteger } 79 | * 80 | */ 81 | public BigInteger getPageSize() { 82 | return pageSize; 83 | } 84 | 85 | /** 86 | * Sets the value of the pageSize property. 87 | * 88 | * @param value 89 | * allowed object is {@link BigInteger } 90 | * 91 | */ 92 | public void setPageSize(BigInteger value) { 93 | this.pageSize = value; 94 | } 95 | 96 | /** 97 | * Gets the value of the totalAvailable property. 98 | * 99 | * @return possible object is {@link BigInteger } 100 | * 101 | */ 102 | public BigInteger getTotalAvailable() { 103 | return totalAvailable; 104 | } 105 | 106 | /** 107 | * Sets the value of the totalAvailable property. 108 | * 109 | * @param value 110 | * allowed object is {@link BigInteger } 111 | * 112 | */ 113 | public void setTotalAvailable(BigInteger value) { 114 | this.totalAvailable = value; 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/ParentType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.09.21 at 01:55:40 PM PDT 6 | // 7 | 8 | 9 | package com.tableausoftware.documentation.api.rest.bindings; 10 | 11 | import javax.xml.bind.annotation.XmlAccessType; 12 | import javax.xml.bind.annotation.XmlAccessorType; 13 | import javax.xml.bind.annotation.XmlAttribute; 14 | import javax.xml.bind.annotation.XmlType; 15 | 16 | 17 | /** 18 | *

Java class for parentType complex type. 19 | * 20 | *

The following schema fragment specifies the expected content contained within this class. 21 | * 22 | *

23 |  * <complexType name="parentType">
24 |  *   <complexContent>
25 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
26 |  *       <attribute name="id" use="required" type="{http://tableau.com/api}resourceIdType" />
27 |  *       <attribute name="type" use="required">
28 |  *         <simpleType>
29 |  *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
30 |  *             <enumeration value="Project"/>
31 |  *           </restriction>
32 |  *         </simpleType>
33 |  *       </attribute>
34 |  *     </restriction>
35 |  *   </complexContent>
36 |  * </complexType>
37 |  * 
38 | * 39 | * 40 | */ 41 | @XmlAccessorType(XmlAccessType.FIELD) 42 | @XmlType(name = "parentType") 43 | public class ParentType { 44 | 45 | @XmlAttribute(name = "id", required = true) 46 | protected String id; 47 | @XmlAttribute(name = "type", required = true) 48 | protected String type; 49 | 50 | /** 51 | * Gets the value of the id property. 52 | * 53 | * @return 54 | * possible object is 55 | * {@link String } 56 | * 57 | */ 58 | public String getId() { 59 | return id; 60 | } 61 | 62 | /** 63 | * Sets the value of the id property. 64 | * 65 | * @param value 66 | * allowed object is 67 | * {@link String } 68 | * 69 | */ 70 | public void setId(String value) { 71 | this.id = value; 72 | } 73 | 74 | /** 75 | * Gets the value of the type property. 76 | * 77 | * @return 78 | * possible object is 79 | * {@link String } 80 | * 81 | */ 82 | public String getType() { 83 | return type; 84 | } 85 | 86 | /** 87 | * Sets the value of the type property. 88 | * 89 | * @param value 90 | * allowed object is 91 | * {@link String } 92 | * 93 | */ 94 | public void setType(String value) { 95 | this.type = value; 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/PermissionsType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.09.21 at 01:55:40 PM PDT 6 | // 7 | 8 | 9 | package com.tableausoftware.documentation.api.rest.bindings; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | import javax.xml.bind.annotation.XmlAccessType; 15 | import javax.xml.bind.annotation.XmlAccessorType; 16 | import javax.xml.bind.annotation.XmlType; 17 | 18 | 19 | /** 20 | *

Java class for permissionsType complex type. 21 | * 22 | *

The following schema fragment specifies the expected content contained within this class. 23 | * 24 | *

 25 |  * <complexType name="permissionsType">
 26 |  *   <complexContent>
 27 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 28 |  *       <sequence>
 29 |  *         <element name="parent" type="{http://tableau.com/api}parentType" minOccurs="0"/>
 30 |  *         <choice minOccurs="0">
 31 |  *           <element name="datasource" type="{http://tableau.com/api}dataSourceType"/>
 32 |  *           <element name="project" type="{http://tableau.com/api}projectType"/>
 33 |  *           <element name="workbook" type="{http://tableau.com/api}workbookType"/>
 34 |  *         </choice>
 35 |  *         <element name="granteeCapabilities" type="{http://tableau.com/api}granteeCapabilitiesType" maxOccurs="unbounded" minOccurs="0"/>
 36 |  *       </sequence>
 37 |  *     </restriction>
 38 |  *   </complexContent>
 39 |  * </complexType>
 40 |  * 
41 | * 42 | * 43 | */ 44 | @XmlAccessorType(XmlAccessType.FIELD) 45 | @XmlType(name = "permissionsType", propOrder = { 46 | "parent", 47 | "workbook", 48 | "granteeCapabilities" 49 | }) 50 | public class PermissionsType { 51 | 52 | protected ParentType parent; 53 | protected WorkbookType workbook; 54 | protected List granteeCapabilities; 55 | 56 | /** 57 | * Gets the value of the parent property. 58 | * 59 | * @return 60 | * possible object is 61 | * {@link ParentType } 62 | * 63 | */ 64 | public ParentType getParent() { 65 | return parent; 66 | } 67 | 68 | /** 69 | * Sets the value of the parent property. 70 | * 71 | * @param value 72 | * allowed object is 73 | * {@link ParentType } 74 | * 75 | */ 76 | public void setParent(ParentType value) { 77 | this.parent = value; 78 | } 79 | 80 | /** 81 | * Gets the value of the workbook property. 82 | * 83 | * @return 84 | * possible object is 85 | * {@link WorkbookType } 86 | * 87 | */ 88 | public WorkbookType getWorkbook() { 89 | return workbook; 90 | } 91 | 92 | /** 93 | * Sets the value of the workbook property. 94 | * 95 | * @param value 96 | * allowed object is 97 | * {@link WorkbookType } 98 | * 99 | */ 100 | public void setWorkbook(WorkbookType value) { 101 | this.workbook = value; 102 | } 103 | 104 | /** 105 | * Gets the value of the granteeCapabilities property. 106 | * 107 | *

108 | * This accessor method returns a reference to the live list, 109 | * not a snapshot. Therefore any modification you make to the 110 | * returned list will be present inside the JAXB object. 111 | * This is why there is not a set method for the granteeCapabilities property. 112 | * 113 | *

114 | * For example, to add a new item, do as follows: 115 | *

116 |      *    getGranteeCapabilities().add(newItem);
117 |      * 
118 | * 119 | * 120 | *

121 | * Objects of the following type(s) are allowed in the list 122 | * {@link GranteeCapabilitiesType } 123 | * 124 | * 125 | */ 126 | public List getGranteeCapabilities() { 127 | if (granteeCapabilities == null) { 128 | granteeCapabilities = new ArrayList(); 129 | } 130 | return this.granteeCapabilities; 131 | } 132 | 133 | } 134 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/ProjectListType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.01.30 at 12:49:43 PM PST 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | import javax.xml.bind.annotation.XmlAccessType; 14 | import javax.xml.bind.annotation.XmlAccessorType; 15 | import javax.xml.bind.annotation.XmlType; 16 | 17 | /** 18 | *

19 | * Java class for projectListType complex type. 20 | * 21 | *

22 | * The following schema fragment specifies the expected content contained within 23 | * this class. 24 | * 25 | *

26 |  * <complexType name="projectListType">
27 |  *   <complexContent>
28 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
29 |  *       <sequence>
30 |  *         <element name="project" type="{http://tableau.com/api}projectType" maxOccurs="unbounded" minOccurs="0"/>
31 |  *       </sequence>
32 |  *     </restriction>
33 |  *   </complexContent>
34 |  * </complexType>
35 |  * 
36 | * 37 | * 38 | */ 39 | @XmlAccessorType(XmlAccessType.FIELD) 40 | @XmlType(name = "projectListType", propOrder = { "project" }) 41 | public class ProjectListType { 42 | 43 | protected List project; 44 | 45 | /** 46 | * Gets the value of the project property. 47 | * 48 | *

49 | * This accessor method returns a reference to the live list, not a 50 | * snapshot. Therefore any modification you make to the returned list will 51 | * be present inside the JAXB object. This is why there is not a 52 | * set method for the project property. 53 | * 54 | *

55 | * For example, to add a new item, do as follows: 56 | * 57 | *

58 |      * getProject().add(newItem);
59 |      * 
60 | * 61 | * 62 | *

63 | * Objects of the following type(s) are allowed in the list 64 | * {@link ProjectType } 65 | * 66 | * 67 | */ 68 | public List getProject() { 69 | if (project == null) { 70 | project = new ArrayList(); 71 | } 72 | return this.project; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/ProjectType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.09.21 at 01:55:40 PM PDT 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import javax.xml.bind.annotation.XmlAccessType; 11 | import javax.xml.bind.annotation.XmlAccessorType; 12 | import javax.xml.bind.annotation.XmlAttribute; 13 | import javax.xml.bind.annotation.XmlType; 14 | 15 | 16 | /** 17 | *

Java class for projectType complex type. 18 | * 19 | *

The following schema fragment specifies the expected content contained within this class. 20 | * 21 | *

 22 |  * <complexType name="projectType">
 23 |  *   <complexContent>
 24 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 25 |  *       <sequence>
 26 |  *         <element name="owner" type="{http://tableau.com/api}userType" minOccurs="0"/>
 27 |  *       </sequence>
 28 |  *       <attribute name="id" type="{http://tableau.com/api}resourceIdType" />
 29 |  *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
 30 |  *       <attribute name="description" type="{http://www.w3.org/2001/XMLSchema}string" />
 31 |  *       <attribute name="contentPermissions">
 32 |  *         <simpleType>
 33 |  *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 34 |  *             <enumeration value="LockedToProject"/>
 35 |  *             <enumeration value="ManagedByOwner"/>
 36 |  *           </restriction>
 37 |  *         </simpleType>
 38 |  *       </attribute>
 39 |  *     </restriction>
 40 |  *   </complexContent>
 41 |  * </complexType>
 42 |  * 
43 | * 44 | * 45 | */ 46 | @XmlAccessorType(XmlAccessType.FIELD) 47 | @XmlType(name = "projectType", propOrder = { 48 | "owner" 49 | }) 50 | public class ProjectType { 51 | 52 | protected UserType owner; 53 | @XmlAttribute(name = "id") 54 | protected String id; 55 | @XmlAttribute(name = "name") 56 | protected String name; 57 | @XmlAttribute(name = "description") 58 | protected String description; 59 | @XmlAttribute(name = "contentPermissions") 60 | protected String contentPermissions; 61 | 62 | /** 63 | * Gets the value of the owner property. 64 | * 65 | * @return 66 | * possible object is 67 | * {@link UserType } 68 | * 69 | */ 70 | public UserType getOwner() { 71 | return owner; 72 | } 73 | 74 | /** 75 | * Sets the value of the owner property. 76 | * 77 | * @param value 78 | * allowed object is 79 | * {@link UserType } 80 | * 81 | */ 82 | public void setOwner(UserType value) { 83 | this.owner = value; 84 | } 85 | 86 | /** 87 | * Gets the value of the id property. 88 | * 89 | * @return 90 | * possible object is 91 | * {@link String } 92 | * 93 | */ 94 | public String getId() { 95 | return id; 96 | } 97 | 98 | /** 99 | * Sets the value of the id property. 100 | * 101 | * @param value 102 | * allowed object is 103 | * {@link String } 104 | * 105 | */ 106 | public void setId(String value) { 107 | this.id = value; 108 | } 109 | 110 | /** 111 | * Gets the value of the name property. 112 | * 113 | * @return 114 | * possible object is 115 | * {@link String } 116 | * 117 | */ 118 | public String getName() { 119 | return name; 120 | } 121 | 122 | /** 123 | * Sets the value of the name property. 124 | * 125 | * @param value 126 | * allowed object is 127 | * {@link String } 128 | * 129 | */ 130 | public void setName(String value) { 131 | this.name = value; 132 | } 133 | 134 | /** 135 | * Gets the value of the description property. 136 | * 137 | * @return 138 | * possible object is 139 | * {@link String } 140 | * 141 | */ 142 | public String getDescription() { 143 | return description; 144 | } 145 | 146 | /** 147 | * Sets the value of the description property. 148 | * 149 | * @param value 150 | * allowed object is 151 | * {@link String } 152 | * 153 | */ 154 | public void setDescription(String value) { 155 | this.description = value; 156 | } 157 | 158 | /** 159 | * Gets the value of the contentPermissions property. 160 | * 161 | * @return 162 | * possible object is 163 | * {@link String } 164 | * 165 | */ 166 | public String getContentPermissions() { 167 | return contentPermissions; 168 | } 169 | 170 | /** 171 | * Sets the value of the contentPermissions property. 172 | * 173 | * @param value 174 | * allowed object is 175 | * {@link String } 176 | * 177 | */ 178 | public void setContentPermissions(String value) { 179 | this.contentPermissions = value; 180 | } 181 | 182 | } 183 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/SiteListType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.01.30 at 12:49:43 PM PST 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | import javax.xml.bind.annotation.XmlAccessType; 14 | import javax.xml.bind.annotation.XmlAccessorType; 15 | import javax.xml.bind.annotation.XmlType; 16 | 17 | /** 18 | *

19 | * Java class for siteListType complex type. 20 | * 21 | *

22 | * The following schema fragment specifies the expected content contained within 23 | * this class. 24 | * 25 | *

26 |  * <complexType name="siteListType">
27 |  *   <complexContent>
28 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
29 |  *       <sequence>
30 |  *         <element name="site" type="{http://tableau.com/api}siteType" maxOccurs="unbounded" minOccurs="0"/>
31 |  *       </sequence>
32 |  *     </restriction>
33 |  *   </complexContent>
34 |  * </complexType>
35 |  * 
36 | * 37 | * 38 | */ 39 | @XmlAccessorType(XmlAccessType.FIELD) 40 | @XmlType(name = "siteListType", propOrder = { "site" }) 41 | public class SiteListType { 42 | 43 | protected List site; 44 | 45 | /** 46 | * Gets the value of the site property. 47 | * 48 | *

49 | * This accessor method returns a reference to the live list, not a 50 | * snapshot. Therefore any modification you make to the returned list will 51 | * be present inside the JAXB object. This is why there is not a 52 | * set method for the site property. 53 | * 54 | *

55 | * For example, to add a new item, do as follows: 56 | * 57 | *

58 |      * getSite().add(newItem);
59 |      * 
60 | * 61 | * 62 | *

63 | * Objects of the following type(s) are allowed in the list {@link SiteType } 64 | * 65 | * 66 | */ 67 | public List getSite() { 68 | if (site == null) { 69 | site = new ArrayList(); 70 | } 71 | return this.site; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/SiteRoleType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.09.21 at 01:55:40 PM PDT 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import javax.xml.bind.annotation.XmlEnum; 11 | import javax.xml.bind.annotation.XmlEnumValue; 12 | import javax.xml.bind.annotation.XmlType; 13 | 14 | /** 15 | *

16 | * Java class for siteRoleType. 17 | * 18 | *

19 | * The following schema fragment specifies the expected content contained within this class. 20 | *

21 | * 22 | *

 23 |  * <simpleType name="siteRoleType">
 24 |  *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 25 |  *     <enumeration value="Guest"/>
 26 |  *     <enumeration value="Creator"/>
 27 |  *     <enumeration value="Explorer"/>
 28 |  *     <enumeration value="ExplorerCanPublish"/>
 29 |  *     <enumeration value="ReadOnly"/>
 30 |  *     <enumeration value="Interactor"/>
 31 |  *     <enumeration value="Publisher"/>
 32 |  *     <enumeration value="ServerAdministrator"/>
 33 |  *     <enumeration value="SiteAdministrator"/>
 34 |  *     <enumeration value="SiteAdministratorCreator"/>
 35 |  *     <enumeration value="SiteAdministratorExplorer"/>
 36 |  *     <enumeration value="Unlicensed"/>
 37 |  *     <enumeration value="UnlicensedWithPublish"/>
 38 |  *     <enumeration value="Viewer"/>
 39 |  *     <enumeration value="ViewerWithPublish"/>
 40 |  *   </restriction>
 41 |  * </simpleType>
 42 |  * 
43 | * 44 | */ 45 | @XmlType(name = "siteRoleType") 46 | @XmlEnum 47 | public enum SiteRoleType { 48 | 49 | @XmlEnumValue("Guest") 50 | GUEST("Guest"), 51 | @XmlEnumValue("Creator") 52 | CREATOR("Creator"), 53 | @XmlEnumValue("Explorer") 54 | EXPLORER("Explorer"), 55 | @XmlEnumValue("ExplorerCanPublish") 56 | EXPLORERCANPUBLISH("ExplorerCanPublish"), 57 | @XmlEnumValue("ReadOnly") 58 | READONLY("ReadOnly"), 59 | @XmlEnumValue("Interactor") 60 | INTERACTOR("Interactor"), 61 | @XmlEnumValue("Publisher") 62 | PUBLISHER("Publisher"), 63 | @XmlEnumValue("ServerAdministrator") 64 | SERVER_ADMINISTRATOR("ServerAdministrator"), 65 | @XmlEnumValue("SiteAdministrator") 66 | SITE_ADMINISTRATOR("SiteAdministrator"), 67 | @XmlEnumValue("SiteAdministratorCreator") 68 | SITE_ADMINISTRATOR_CREATOR("SiteAdministratorCreator"), 69 | @XmlEnumValue("SiteAdministratorExplorer") 70 | SITE_ADMINISTRATOR_EXPLORER("SiteAdministratorExplorer"), 71 | @XmlEnumValue("Unlicensed") 72 | UNLICENSED("Unlicensed"), 73 | @XmlEnumValue("UnlicensedWithPublish") 74 | UNLICENSED_WITH_PUBLISH("UnlicensedWithPublish"), 75 | @XmlEnumValue("Viewer") 76 | VIEWER("Viewer"), 77 | @XmlEnumValue("ViewerWithPublish") 78 | VIEWER_WITH_PUBLISH("ViewerWithPublish"); 79 | 80 | private final String value; 81 | 82 | SiteRoleType(String v) { 83 | value = v; 84 | } 85 | 86 | public String value() { 87 | return value; 88 | } 89 | 90 | public static SiteRoleType fromValue(String v) { 91 | for (SiteRoleType c : SiteRoleType.values()) { 92 | if (c.value.equals(v)) { 93 | return c; 94 | } 95 | } 96 | throw new IllegalArgumentException(v); 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/SiteType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.09.21 at 01:55:40 PM PDT 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import java.math.BigInteger; 11 | 12 | import javax.xml.bind.annotation.XmlAccessType; 13 | import javax.xml.bind.annotation.XmlAccessorType; 14 | import javax.xml.bind.annotation.XmlAttribute; 15 | import javax.xml.bind.annotation.XmlSchemaType; 16 | import javax.xml.bind.annotation.XmlType; 17 | 18 | /** 19 | *

20 | * Java class for siteType complex type. 21 | * 22 | *

23 | * The following schema fragment specifies the expected content contained within 24 | * this class. 25 | * 26 | *

 27 |  * <complexType name="siteType">
 28 |  *   <complexContent>
 29 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 30 |  *       <sequence>
 31 |  *         <element name="usage" minOccurs="0">
 32 |  *           <complexType>
 33 |  *             <complexContent>
 34 |  *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 35 |  *                 <attribute name="numUsers" use="required" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" />
 36 |  *                 <attribute name="storage" use="required" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" />
 37 |  *               </restriction>
 38 |  *             </complexContent>
 39 |  *           </complexType>
 40 |  *         </element>
 41 |  *       </sequence>
 42 |  *       <attribute name="id" type="{http://tableau.com/api}resourceIdType" />
 43 |  *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
 44 |  *       <attribute name="contentUrl" type="{http://www.w3.org/2001/XMLSchema}string" />
 45 |  *       <attribute name="adminMode">
 46 |  *         <simpleType>
 47 |  *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 48 |  *             <enumeration value="ContentOnly"/>
 49 |  *             <enumeration value="ContentAndUsers"/>
 50 |  *           </restriction>
 51 |  *         </simpleType>
 52 |  *       </attribute>
 53 |  *       <attribute name="userQuota" type="{http://tableau.com/api}siteQuotaType" />
 54 |  *       <attribute name="storageQuota" type="{http://tableau.com/api}siteQuotaType" />
 55 |  *       <attribute name="disableSubscriptions" type="{http://www.w3.org/2001/XMLSchema}boolean" />
 56 |  *       <attribute name="state">
 57 |  *         <simpleType>
 58 |  *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 59 |  *             <enumeration value="Active"/>
 60 |  *             <enumeration value="Suspended"/>
 61 |  *           </restriction>
 62 |  *         </simpleType>
 63 |  *       </attribute>
 64 |  *     </restriction>
 65 |  *   </complexContent>
 66 |  * </complexType>
 67 |  * 
68 | * 69 | * 70 | */ 71 | @XmlAccessorType(XmlAccessType.FIELD) 72 | @XmlType(name = "siteType", propOrder = { "usage" }) 73 | public class SiteType { 74 | 75 | protected SiteType.Usage usage; 76 | @XmlAttribute(name = "id") 77 | protected String id; 78 | @XmlAttribute(name = "name") 79 | protected String name; 80 | @XmlAttribute(name = "contentUrl") 81 | protected String contentUrl; 82 | @XmlAttribute(name = "adminMode") 83 | protected String adminMode; 84 | @XmlAttribute(name = "userQuota") 85 | protected BigInteger userQuota; 86 | @XmlAttribute(name = "storageQuota") 87 | protected BigInteger storageQuota; 88 | @XmlAttribute(name = "disableSubscriptions") 89 | protected Boolean disableSubscriptions; 90 | @XmlAttribute(name = "state") 91 | protected String state; 92 | 93 | /** 94 | * Gets the value of the usage property. 95 | * 96 | * @return possible object is {@link SiteType.Usage } 97 | * 98 | */ 99 | public SiteType.Usage getUsage() { 100 | return usage; 101 | } 102 | 103 | /** 104 | * Sets the value of the usage property. 105 | * 106 | * @param value 107 | * allowed object is {@link SiteType.Usage } 108 | * 109 | */ 110 | public void setUsage(SiteType.Usage value) { 111 | this.usage = value; 112 | } 113 | 114 | /** 115 | * Gets the value of the id property. 116 | * 117 | * @return possible object is {@link String } 118 | * 119 | */ 120 | public String getId() { 121 | return id; 122 | } 123 | 124 | /** 125 | * Sets the value of the id property. 126 | * 127 | * @param value 128 | * allowed object is {@link String } 129 | * 130 | */ 131 | public void setId(String value) { 132 | this.id = value; 133 | } 134 | 135 | /** 136 | * Gets the value of the name property. 137 | * 138 | * @return possible object is {@link String } 139 | * 140 | */ 141 | public String getName() { 142 | return name; 143 | } 144 | 145 | /** 146 | * Sets the value of the name property. 147 | * 148 | * @param value 149 | * allowed object is {@link String } 150 | * 151 | */ 152 | public void setName(String value) { 153 | this.name = value; 154 | } 155 | 156 | /** 157 | * Gets the value of the contentUrl property. 158 | * 159 | * @return possible object is {@link String } 160 | * 161 | */ 162 | public String getContentUrl() { 163 | return contentUrl; 164 | } 165 | 166 | /** 167 | * Sets the value of the contentUrl property. 168 | * 169 | * @param value 170 | * allowed object is {@link String } 171 | * 172 | */ 173 | public void setContentUrl(String value) { 174 | this.contentUrl = value; 175 | } 176 | 177 | /** 178 | * Gets the value of the adminMode property. 179 | * 180 | * @return possible object is {@link String } 181 | * 182 | */ 183 | public String getAdminMode() { 184 | return adminMode; 185 | } 186 | 187 | /** 188 | * Sets the value of the adminMode property. 189 | * 190 | * @param value 191 | * allowed object is {@link String } 192 | * 193 | */ 194 | public void setAdminMode(String value) { 195 | this.adminMode = value; 196 | } 197 | 198 | /** 199 | * Gets the value of the userQuota property. 200 | * 201 | * @return possible object is {@link BigInteger } 202 | * 203 | */ 204 | public BigInteger getUserQuota() { 205 | return userQuota; 206 | } 207 | 208 | /** 209 | * Sets the value of the userQuota property. 210 | * 211 | * @param value 212 | * allowed object is {@link BigInteger } 213 | * 214 | */ 215 | public void setUserQuota(BigInteger value) { 216 | this.userQuota = value; 217 | } 218 | 219 | /** 220 | * Gets the value of the storageQuota property. 221 | * 222 | * @return possible object is {@link BigInteger } 223 | * 224 | */ 225 | public BigInteger getStorageQuota() { 226 | return storageQuota; 227 | } 228 | 229 | /** 230 | * Sets the value of the storageQuota property. 231 | * 232 | * @param value 233 | * allowed object is {@link BigInteger } 234 | * 235 | */ 236 | public void setStorageQuota(BigInteger value) { 237 | this.storageQuota = value; 238 | } 239 | 240 | /** 241 | * Gets the value of the disableSubscriptions property. 242 | * 243 | * @return possible object is {@link Boolean } 244 | * 245 | */ 246 | public Boolean isDisableSubscriptions() { 247 | return disableSubscriptions; 248 | } 249 | 250 | /** 251 | * Sets the value of the disableSubscriptions property. 252 | * 253 | * @param value 254 | * allowed object is {@link Boolean } 255 | * 256 | */ 257 | public void setDisableSubscriptions(Boolean value) { 258 | this.disableSubscriptions = value; 259 | } 260 | 261 | /** 262 | * Gets the value of the state property. 263 | * 264 | * @return possible object is {@link String } 265 | * 266 | */ 267 | public String getState() { 268 | return state; 269 | } 270 | 271 | /** 272 | * Sets the value of the state property. 273 | * 274 | * @param value 275 | * allowed object is {@link String } 276 | * 277 | */ 278 | public void setState(String value) { 279 | this.state = value; 280 | } 281 | 282 | /** 283 | *

284 | * Java class for anonymous complex type. 285 | * 286 | *

287 | * The following schema fragment specifies the expected content contained 288 | * within this class. 289 | * 290 | *

291 |      * <complexType>
292 |      *   <complexContent>
293 |      *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
294 |      *       <attribute name="numUsers" use="required" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" />
295 |      *       <attribute name="storage" use="required" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" />
296 |      *     </restriction>
297 |      *   </complexContent>
298 |      * </complexType>
299 |      * 
300 | * 301 | * 302 | */ 303 | @XmlAccessorType(XmlAccessType.FIELD) 304 | @XmlType(name = "") 305 | public static class Usage { 306 | 307 | @XmlAttribute(name = "numUsers", required = true) 308 | @XmlSchemaType(name = "nonNegativeInteger") 309 | protected BigInteger numUsers; 310 | @XmlAttribute(name = "storage", required = true) 311 | @XmlSchemaType(name = "nonNegativeInteger") 312 | protected BigInteger storage; 313 | 314 | /** 315 | * Gets the value of the numUsers property. 316 | * 317 | * @return possible object is {@link BigInteger } 318 | * 319 | */ 320 | public BigInteger getNumUsers() { 321 | return numUsers; 322 | } 323 | 324 | /** 325 | * Sets the value of the numUsers property. 326 | * 327 | * @param value 328 | * allowed object is {@link BigInteger } 329 | * 330 | */ 331 | public void setNumUsers(BigInteger value) { 332 | this.numUsers = value; 333 | } 334 | 335 | /** 336 | * Gets the value of the storage property. 337 | * 338 | * @return possible object is {@link BigInteger } 339 | * 340 | */ 341 | public BigInteger getStorage() { 342 | return storage; 343 | } 344 | 345 | /** 346 | * Sets the value of the storage property. 347 | * 348 | * @param value 349 | * allowed object is {@link BigInteger } 350 | * 351 | */ 352 | public void setStorage(BigInteger value) { 353 | this.storage = value; 354 | } 355 | 356 | } 357 | 358 | } 359 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/TableauCredentialsType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.01.30 at 12:49:43 PM PST 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import javax.xml.bind.annotation.XmlAccessType; 11 | import javax.xml.bind.annotation.XmlAccessorType; 12 | import javax.xml.bind.annotation.XmlAttribute; 13 | import javax.xml.bind.annotation.XmlElement; 14 | import javax.xml.bind.annotation.XmlType; 15 | 16 | /** 17 | *

18 | * Java class for tableauCredentialsType complex type. 19 | * 20 | *

21 | * The following schema fragment specifies the expected content contained within 22 | * this class. 23 | * 24 | *

 25 |  * <complexType name="tableauCredentialsType">
 26 |  *   <complexContent>
 27 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 28 |  *       <sequence>
 29 |  *         <element name="site" type="{http://tableau.com/api}siteType"/>
 30 |  *         <element name="user" type="{http://tableau.com/api}userType" minOccurs="0"/>
 31 |  *       </sequence>
 32 |  *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
 33 |  *       <attribute name="password" type="{http://www.w3.org/2001/XMLSchema}string" />
 34 |  *       <attribute name="token" type="{http://www.w3.org/2001/XMLSchema}string" />
 35 |  *     </restriction>
 36 |  *   </complexContent>
 37 |  * </complexType>
 38 |  * 
39 | * 40 | * 41 | */ 42 | @XmlAccessorType(XmlAccessType.FIELD) 43 | @XmlType(name = "tableauCredentialsType", propOrder = { "site", "user" }) 44 | public class TableauCredentialsType { 45 | 46 | @XmlElement(required = true) 47 | protected SiteType site; 48 | protected UserType user; 49 | @XmlAttribute(name = "name") 50 | protected String name; 51 | @XmlAttribute(name = "password") 52 | protected String password; 53 | @XmlAttribute(name = "token") 54 | protected String token; 55 | 56 | /** 57 | * Gets the value of the site property. 58 | * 59 | * @return possible object is {@link SiteType } 60 | * 61 | */ 62 | public SiteType getSite() { 63 | return site; 64 | } 65 | 66 | /** 67 | * Sets the value of the site property. 68 | * 69 | * @param value 70 | * allowed object is {@link SiteType } 71 | * 72 | */ 73 | public void setSite(SiteType value) { 74 | this.site = value; 75 | } 76 | 77 | /** 78 | * Gets the value of the user property. 79 | * 80 | * @return possible object is {@link UserType } 81 | * 82 | */ 83 | public UserType getUser() { 84 | return user; 85 | } 86 | 87 | /** 88 | * Sets the value of the user property. 89 | * 90 | * @param value 91 | * allowed object is {@link UserType } 92 | * 93 | */ 94 | public void setUser(UserType value) { 95 | this.user = value; 96 | } 97 | 98 | /** 99 | * Gets the value of the name property. 100 | * 101 | * @return possible object is {@link String } 102 | * 103 | */ 104 | public String getName() { 105 | return name; 106 | } 107 | 108 | /** 109 | * Sets the value of the name property. 110 | * 111 | * @param value 112 | * allowed object is {@link String } 113 | * 114 | */ 115 | public void setName(String value) { 116 | this.name = value; 117 | } 118 | 119 | /** 120 | * Gets the value of the password property. 121 | * 122 | * @return possible object is {@link String } 123 | * 124 | */ 125 | public String getPassword() { 126 | return password; 127 | } 128 | 129 | /** 130 | * Sets the value of the password property. 131 | * 132 | * @param value 133 | * allowed object is {@link String } 134 | * 135 | */ 136 | public void setPassword(String value) { 137 | this.password = value; 138 | } 139 | 140 | /** 141 | * Gets the value of the token property. 142 | * 143 | * @return possible object is {@link String } 144 | * 145 | */ 146 | public String getToken() { 147 | return token; 148 | } 149 | 150 | /** 151 | * Sets the value of the token property. 152 | * 153 | * @param value 154 | * allowed object is {@link String } 155 | * 156 | */ 157 | public void setToken(String value) { 158 | this.token = value; 159 | } 160 | 161 | } 162 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/TagListType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.01.30 at 12:49:43 PM PST 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | import javax.xml.bind.annotation.XmlAccessType; 14 | import javax.xml.bind.annotation.XmlAccessorType; 15 | import javax.xml.bind.annotation.XmlType; 16 | 17 | /** 18 | *

19 | * Java class for tagListType complex type. 20 | * 21 | *

22 | * The following schema fragment specifies the expected content contained within 23 | * this class. 24 | * 25 | *

26 |  * <complexType name="tagListType">
27 |  *   <complexContent>
28 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
29 |  *       <sequence>
30 |  *         <element name="tag" type="{http://tableau.com/api}tagType" maxOccurs="unbounded" minOccurs="0"/>
31 |  *       </sequence>
32 |  *     </restriction>
33 |  *   </complexContent>
34 |  * </complexType>
35 |  * 
36 | * 37 | * 38 | */ 39 | @XmlAccessorType(XmlAccessType.FIELD) 40 | @XmlType(name = "tagListType", propOrder = { "tag" }) 41 | public class TagListType { 42 | 43 | protected List tag; 44 | 45 | /** 46 | * Gets the value of the tag property. 47 | * 48 | *

49 | * This accessor method returns a reference to the live list, not a 50 | * snapshot. Therefore any modification you make to the returned list will 51 | * be present inside the JAXB object. This is why there is not a 52 | * set method for the tag property. 53 | * 54 | *

55 | * For example, to add a new item, do as follows: 56 | * 57 | *

58 |      * getTag().add(newItem);
59 |      * 
60 | * 61 | * 62 | *

63 | * Objects of the following type(s) are allowed in the list {@link TagType } 64 | * 65 | * 66 | */ 67 | public List getTag() { 68 | if (tag == null) { 69 | tag = new ArrayList(); 70 | } 71 | return this.tag; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/TagType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.01.30 at 12:49:43 PM PST 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import javax.xml.bind.annotation.XmlAccessType; 11 | import javax.xml.bind.annotation.XmlAccessorType; 12 | import javax.xml.bind.annotation.XmlAttribute; 13 | import javax.xml.bind.annotation.XmlType; 14 | 15 | /** 16 | *

17 | * Java class for tagType complex type. 18 | * 19 | *

20 | * The following schema fragment specifies the expected content contained within 21 | * this class. 22 | * 23 | *

24 |  * <complexType name="tagType">
25 |  *   <complexContent>
26 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
27 |  *       <attribute name="label" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
28 |  *     </restriction>
29 |  *   </complexContent>
30 |  * </complexType>
31 |  * 
32 | * 33 | * 34 | */ 35 | @XmlAccessorType(XmlAccessType.FIELD) 36 | @XmlType(name = "tagType") 37 | public class TagType { 38 | 39 | @XmlAttribute(name = "label", required = true) 40 | protected String label; 41 | 42 | /** 43 | * Gets the value of the label property. 44 | * 45 | * @return possible object is {@link String } 46 | * 47 | */ 48 | public String getLabel() { 49 | return label; 50 | } 51 | 52 | /** 53 | * Sets the value of the label property. 54 | * 55 | * @param value 56 | * allowed object is {@link String } 57 | * 58 | */ 59 | public void setLabel(String value) { 60 | this.label = value; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/TsRequest.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.01.30 at 12:49:43 PM PST 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import javax.xml.bind.annotation.XmlAccessType; 11 | import javax.xml.bind.annotation.XmlAccessorType; 12 | import javax.xml.bind.annotation.XmlRootElement; 13 | import javax.xml.bind.annotation.XmlType; 14 | 15 | /** 16 | *

17 | * Java class for anonymous complex type. 18 | * 19 | *

20 | * The following schema fragment specifies the expected content contained within 21 | * this class. 22 | * 23 | *

 24 |  * <complexType>
 25 |  *   <complexContent>
 26 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 27 |  *       <choice>
 28 |  *         <element name="connection" type="{http://tableau.com/api}connectionType"/>
 29 |  *         <element name="credentials" type="{http://tableau.com/api}tableauCredentialsType"/>
 30 |  *         <element name="datasource" type="{http://tableau.com/api}dataSourceType"/>
 31 |  *         <element name="favorite" type="{http://tableau.com/api}favoriteType"/>
 32 |  *         <element name="group" type="{http://tableau.com/api}groupType"/>
 33 |  *         <element name="permissions" type="{http://tableau.com/api}permissionsType"/>
 34 |  *         <element name="project" type="{http://tableau.com/api}projectType"/>
 35 |  *         <element name="site" type="{http://tableau.com/api}siteType"/>
 36 |  *         <element name="tags" type="{http://tableau.com/api}tagListType"/>
 37 |  *         <element name="user" type="{http://tableau.com/api}userType"/>
 38 |  *         <element name="workbook" type="{http://tableau.com/api}workbookType"/>
 39 |  *       </choice>
 40 |  *     </restriction>
 41 |  *   </complexContent>
 42 |  * </complexType>
 43 |  * 
44 | * 45 | * 46 | */ 47 | @XmlAccessorType(XmlAccessType.FIELD) 48 | @XmlType(name = "", propOrder = { "credentials", "group", "permissions", "workbook" }) 49 | @XmlRootElement(name = "tsRequest") 50 | public class TsRequest { 51 | 52 | protected TableauCredentialsType credentials; 53 | protected GroupType group; 54 | protected PermissionsType permissions; 55 | protected WorkbookType workbook; 56 | 57 | /** 58 | * Gets the value of the credentials property. 59 | * 60 | * @return possible object is {@link TableauCredentialsType } 61 | * 62 | */ 63 | public TableauCredentialsType getCredentials() { 64 | return credentials; 65 | } 66 | 67 | /** 68 | * Sets the value of the credentials property. 69 | * 70 | * @param value 71 | * allowed object is {@link TableauCredentialsType } 72 | * 73 | */ 74 | public void setCredentials(TableauCredentialsType value) { 75 | this.credentials = value; 76 | } 77 | 78 | /** 79 | * Gets the value of the group property. 80 | * 81 | * @return possible object is {@link GroupType } 82 | * 83 | */ 84 | public GroupType getGroup() { 85 | return group; 86 | } 87 | 88 | /** 89 | * Sets the value of the group property. 90 | * 91 | * @param value 92 | * allowed object is {@link GroupType } 93 | * 94 | */ 95 | public void setGroup(GroupType value) { 96 | this.group = value; 97 | } 98 | 99 | /** 100 | * Gets the value of the permissions property. 101 | * 102 | * @return possible object is {@link PermissionsType } 103 | * 104 | */ 105 | public PermissionsType getPermissions() { 106 | return permissions; 107 | } 108 | 109 | /** 110 | * Sets the value of the permissions property. 111 | * 112 | * @param value 113 | * allowed object is {@link PermissionsType } 114 | * 115 | */ 116 | public void setPermissions(PermissionsType value) { 117 | this.permissions = value; 118 | } 119 | 120 | /** 121 | * Gets the value of the workbook property. 122 | * 123 | * @return possible object is {@link WorkbookType } 124 | * 125 | */ 126 | public WorkbookType getWorkbook() { 127 | return workbook; 128 | } 129 | 130 | /** 131 | * Sets the value of the workbook property. 132 | * 133 | * @param value 134 | * allowed object is {@link WorkbookType } 135 | * 136 | */ 137 | public void setWorkbook(WorkbookType value) { 138 | this.workbook = value; 139 | } 140 | 141 | } 142 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/TsResponse.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.01.30 at 12:49:43 PM PST 6 | // 7 | 8 | 9 | package com.tableausoftware.documentation.api.rest.bindings; 10 | 11 | import javax.xml.bind.annotation.XmlAccessType; 12 | import javax.xml.bind.annotation.XmlAccessorType; 13 | import javax.xml.bind.annotation.XmlRootElement; 14 | import javax.xml.bind.annotation.XmlType; 15 | 16 | 17 | /** 18 | *

Java class for anonymous complex type. 19 | * 20 | *

The following schema fragment specifies the expected content contained within this class. 21 | * 22 | *

 23 |  * <complexType>
 24 |  *   <complexContent>
 25 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 26 |  *       <choice>
 27 |  *         <group ref="{http://tableau.com/api}paginatedResponseGroup"/>
 28 |  *         <element name="connection" type="{http://tableau.com/api}connectionType"/>
 29 |  *         <element name="connections" type="{http://tableau.com/api}connectionListType"/>
 30 |  *         <element name="credentials" type="{http://tableau.com/api}tableauCredentialsType"/>
 31 |  *         <element name="datasource" type="{http://tableau.com/api}dataSourceType"/>
 32 |  *         <element name="error" type="{http://tableau.com/api}errorType"/>
 33 |  *         <element name="favorites" type="{http://tableau.com/api}favoriteListType"/>
 34 |  *         <element name="fileUpload" type="{http://tableau.com/api}fileUploadType"/>
 35 |  *         <element name="group" type="{http://tableau.com/api}groupType"/>
 36 |  *         <element name="job" type="{http://tableau.com/api}jobType"/>
 37 |  *         <element name="permissions" type="{http://tableau.com/api}permissionsType"/>
 38 |  *         <element name="project" type="{http://tableau.com/api}projectType"/>
 39 |  *         <element name="site" type="{http://tableau.com/api}siteType"/>
 40 |  *         <element name="tags" type="{http://tableau.com/api}tagListType"/>
 41 |  *         <element name="user" type="{http://tableau.com/api}userType"/>
 42 |  *         <element name="views" type="{http://tableau.com/api}viewListType"/>
 43 |  *         <element name="workbook" type="{http://tableau.com/api}workbookType"/>
 44 |  *       </choice>
 45 |  *     </restriction>
 46 |  *   </complexContent>
 47 |  * </complexType>
 48 |  * 
49 | * 50 | * 51 | */ 52 | @XmlAccessorType(XmlAccessType.FIELD) 53 | @XmlType(name = "", propOrder = { 54 | "pagination", 55 | "groups", 56 | "projects", 57 | "sites", 58 | "workbooks", 59 | "credentials", 60 | "error", 61 | "fileUpload", 62 | "group", 63 | "permissions", 64 | "workbook" 65 | }) 66 | @XmlRootElement(name = "tsResponse") 67 | public class TsResponse { 68 | 69 | protected PaginationType pagination; 70 | protected GroupListType groups; 71 | protected ProjectListType projects; 72 | protected SiteListType sites; 73 | protected WorkbookListType workbooks; 74 | protected TableauCredentialsType credentials; 75 | protected ErrorType error; 76 | protected FileUploadType fileUpload; 77 | protected GroupType group; 78 | protected PermissionsType permissions; 79 | protected WorkbookType workbook; 80 | 81 | /** 82 | * Gets the value of the pagination property. 83 | * 84 | * @return 85 | * possible object is 86 | * {@link PaginationType } 87 | * 88 | */ 89 | public PaginationType getPagination() { 90 | return pagination; 91 | } 92 | 93 | /** 94 | * Sets the value of the pagination property. 95 | * 96 | * @param value 97 | * allowed object is 98 | * {@link PaginationType } 99 | * 100 | */ 101 | public void setPagination(PaginationType value) { 102 | this.pagination = value; 103 | } 104 | 105 | /** 106 | * Gets the value of the groups property. 107 | * 108 | * @return 109 | * possible object is 110 | * {@link GroupListType } 111 | * 112 | */ 113 | public GroupListType getGroups() { 114 | return groups; 115 | } 116 | 117 | /** 118 | * Sets the value of the groups property. 119 | * 120 | * @param value 121 | * allowed object is 122 | * {@link GroupListType } 123 | * 124 | */ 125 | public void setGroups(GroupListType value) { 126 | this.groups = value; 127 | } 128 | 129 | /** 130 | * Gets the value of the projects property. 131 | * 132 | * @return 133 | * possible object is 134 | * {@link ProjectListType } 135 | * 136 | */ 137 | public ProjectListType getProjects() { 138 | return projects; 139 | } 140 | 141 | /** 142 | * Sets the value of the projects property. 143 | * 144 | * @param value 145 | * allowed object is 146 | * {@link ProjectListType } 147 | * 148 | */ 149 | public void setProjects(ProjectListType value) { 150 | this.projects = value; 151 | } 152 | 153 | /** 154 | * Gets the value of the sites property. 155 | * 156 | * @return 157 | * possible object is 158 | * {@link SiteListType } 159 | * 160 | */ 161 | public SiteListType getSites() { 162 | return sites; 163 | } 164 | 165 | /** 166 | * Sets the value of the sites property. 167 | * 168 | * @param value 169 | * allowed object is 170 | * {@link SiteListType } 171 | * 172 | */ 173 | public void setSites(SiteListType value) { 174 | this.sites = value; 175 | } 176 | 177 | /** 178 | * Gets the value of the workbooks property. 179 | * 180 | * @return 181 | * possible object is 182 | * {@link WorkbookListType } 183 | * 184 | */ 185 | public WorkbookListType getWorkbooks() { 186 | return workbooks; 187 | } 188 | 189 | /** 190 | * Sets the value of the workbooks property. 191 | * 192 | * @param value 193 | * allowed object is 194 | * {@link WorkbookListType } 195 | * 196 | */ 197 | public void setWorkbooks(WorkbookListType value) { 198 | this.workbooks = value; 199 | } 200 | 201 | /** 202 | * Gets the value of the credentials property. 203 | * 204 | * @return 205 | * possible object is 206 | * {@link TableauCredentialsType } 207 | * 208 | */ 209 | public TableauCredentialsType getCredentials() { 210 | return credentials; 211 | } 212 | 213 | /** 214 | * Sets the value of the credentials property. 215 | * 216 | * @param value 217 | * allowed object is 218 | * {@link TableauCredentialsType } 219 | * 220 | */ 221 | public void setCredentials(TableauCredentialsType value) { 222 | this.credentials = value; 223 | } 224 | 225 | /** 226 | * Gets the value of the error property. 227 | * 228 | * @return 229 | * possible object is 230 | * {@link ErrorType } 231 | * 232 | */ 233 | public ErrorType getError() { 234 | return error; 235 | } 236 | 237 | /** 238 | * Sets the value of the error property. 239 | * 240 | * @param value 241 | * allowed object is 242 | * {@link ErrorType } 243 | * 244 | */ 245 | public void setError(ErrorType value) { 246 | this.error = value; 247 | } 248 | 249 | /** 250 | * Gets the value of the fileUpload property. 251 | * 252 | * @return 253 | * possible object is 254 | * {@link FileUploadType } 255 | * 256 | */ 257 | public FileUploadType getFileUpload() { 258 | return fileUpload; 259 | } 260 | 261 | /** 262 | * Sets the value of the fileUpload property. 263 | * 264 | * @param value 265 | * allowed object is 266 | * {@link FileUploadType } 267 | * 268 | */ 269 | public void setFileUpload(FileUploadType value) { 270 | this.fileUpload = value; 271 | } 272 | 273 | /** 274 | * Gets the value of the group property. 275 | * 276 | * @return 277 | * possible object is 278 | * {@link GroupType } 279 | * 280 | */ 281 | public GroupType getGroup() { 282 | return group; 283 | } 284 | 285 | /** 286 | * Sets the value of the group property. 287 | * 288 | * @param value 289 | * allowed object is 290 | * {@link GroupType } 291 | * 292 | */ 293 | public void setGroup(GroupType value) { 294 | this.group = value; 295 | } 296 | 297 | /** 298 | * Gets the value of the permissions property. 299 | * 300 | * @return 301 | * possible object is 302 | * {@link PermissionsType } 303 | * 304 | */ 305 | public PermissionsType getPermissions() { 306 | return permissions; 307 | } 308 | 309 | /** 310 | * Sets the value of the permissions property. 311 | * 312 | * @param value 313 | * allowed object is 314 | * {@link PermissionsType } 315 | * 316 | */ 317 | public void setPermissions(PermissionsType value) { 318 | this.permissions = value; 319 | } 320 | 321 | /** 322 | * Gets the value of the workbook property. 323 | * 324 | * @return 325 | * possible object is 326 | * {@link WorkbookType } 327 | * 328 | */ 329 | public WorkbookType getWorkbook() { 330 | return workbook; 331 | } 332 | 333 | /** 334 | * Sets the value of the workbook property. 335 | * 336 | * @param value 337 | * allowed object is 338 | * {@link WorkbookType } 339 | * 340 | */ 341 | public void setWorkbook(WorkbookType value) { 342 | this.workbook = value; 343 | } 344 | 345 | } 346 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/UserType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.09.21 at 01:55:40 PM PDT 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import javax.xml.bind.annotation.XmlAccessType; 11 | import javax.xml.bind.annotation.XmlAccessorType; 12 | import javax.xml.bind.annotation.XmlAttribute; 13 | import javax.xml.bind.annotation.XmlSchemaType; 14 | import javax.xml.bind.annotation.XmlType; 15 | import javax.xml.datatype.XMLGregorianCalendar; 16 | 17 | /** 18 | *

19 | * Java class for userType complex type. 20 | * 21 | *

22 | * The following schema fragment specifies the expected content contained within 23 | * this class. 24 | * 25 | *

 26 |  * <complexType name="userType">
 27 |  *   <complexContent>
 28 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 29 |  *       <attribute name="id" type="{http://tableau.com/api}resourceIdType" />
 30 |  *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
 31 |  *       <attribute name="fullName" type="{http://www.w3.org/2001/XMLSchema}string" />
 32 |  *       <attribute name="email" type="{http://www.w3.org/2001/XMLSchema}string" />
 33 |  *       <attribute name="password" type="{http://www.w3.org/2001/XMLSchema}string" />
 34 |  *       <attribute name="siteRole" type="{http://tableau.com/api}siteRoleType" />
 35 |  *       <attribute name="lastLogin" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
 36 |  *       <attribute name="externalAuthUserId" type="{http://www.w3.org/2001/XMLSchema}string" />
 37 |  *     </restriction>
 38 |  *   </complexContent>
 39 |  * </complexType>
 40 |  * 
41 | * 42 | * 43 | */ 44 | @XmlAccessorType(XmlAccessType.FIELD) 45 | @XmlType(name = "userType") 46 | public class UserType { 47 | 48 | @XmlAttribute(name = "id") 49 | protected String id; 50 | @XmlAttribute(name = "name") 51 | protected String name; 52 | @XmlAttribute(name = "fullName") 53 | protected String fullName; 54 | @XmlAttribute(name = "email") 55 | protected String email; 56 | @XmlAttribute(name = "password") 57 | protected String password; 58 | @XmlAttribute(name = "siteRole") 59 | protected SiteRoleType siteRole; 60 | @XmlAttribute(name = "lastLogin") 61 | @XmlSchemaType(name = "dateTime") 62 | protected XMLGregorianCalendar lastLogin; 63 | @XmlAttribute(name = "externalAuthUserId") 64 | protected String externalAuthUserId; 65 | 66 | /** 67 | * Gets the value of the id property. 68 | * 69 | * @return possible object is {@link String } 70 | * 71 | */ 72 | public String getId() { 73 | return id; 74 | } 75 | 76 | /** 77 | * Sets the value of the id property. 78 | * 79 | * @param value 80 | * allowed object is {@link String } 81 | * 82 | */ 83 | public void setId(String value) { 84 | this.id = value; 85 | } 86 | 87 | /** 88 | * Gets the value of the name property. 89 | * 90 | * @return possible object is {@link String } 91 | * 92 | */ 93 | public String getName() { 94 | return name; 95 | } 96 | 97 | /** 98 | * Sets the value of the name property. 99 | * 100 | * @param value 101 | * allowed object is {@link String } 102 | * 103 | */ 104 | public void setName(String value) { 105 | this.name = value; 106 | } 107 | 108 | /** 109 | * Gets the value of the fullName property. 110 | * 111 | * @return possible object is {@link String } 112 | * 113 | */ 114 | public String getFullName() { 115 | return fullName; 116 | } 117 | 118 | /** 119 | * Sets the value of the fullName property. 120 | * 121 | * @param value 122 | * allowed object is {@link String } 123 | * 124 | */ 125 | public void setFullName(String value) { 126 | this.fullName = value; 127 | } 128 | 129 | /** 130 | * Gets the value of the email property. 131 | * 132 | * @return possible object is {@link String } 133 | * 134 | */ 135 | public String getEmail() { 136 | return email; 137 | } 138 | 139 | /** 140 | * Sets the value of the email property. 141 | * 142 | * @param value 143 | * allowed object is {@link String } 144 | * 145 | */ 146 | public void setEmail(String value) { 147 | this.email = value; 148 | } 149 | 150 | /** 151 | * Gets the value of the password property. 152 | * 153 | * @return possible object is {@link String } 154 | * 155 | */ 156 | public String getPassword() { 157 | return password; 158 | } 159 | 160 | /** 161 | * Sets the value of the password property. 162 | * 163 | * @param value 164 | * allowed object is {@link String } 165 | * 166 | */ 167 | public void setPassword(String value) { 168 | this.password = value; 169 | } 170 | 171 | /** 172 | * Gets the value of the siteRole property. 173 | * 174 | * @return possible object is {@link SiteRoleType } 175 | * 176 | */ 177 | public SiteRoleType getSiteRole() { 178 | return siteRole; 179 | } 180 | 181 | /** 182 | * Sets the value of the siteRole property. 183 | * 184 | * @param value 185 | * allowed object is {@link SiteRoleType } 186 | * 187 | */ 188 | public void setSiteRole(SiteRoleType value) { 189 | this.siteRole = value; 190 | } 191 | 192 | /** 193 | * Gets the value of the lastLogin property. 194 | * 195 | * @return possible object is {@link XMLGregorianCalendar } 196 | * 197 | */ 198 | public XMLGregorianCalendar getLastLogin() { 199 | return lastLogin; 200 | } 201 | 202 | /** 203 | * Sets the value of the lastLogin property. 204 | * 205 | * @param value 206 | * allowed object is {@link XMLGregorianCalendar } 207 | * 208 | */ 209 | public void setLastLogin(XMLGregorianCalendar value) { 210 | this.lastLogin = value; 211 | } 212 | 213 | /** 214 | * Gets the value of the externalAuthUserId property. 215 | * 216 | * @return possible object is {@link String } 217 | * 218 | */ 219 | public String getExternalAuthUserId() { 220 | return externalAuthUserId; 221 | } 222 | 223 | /** 224 | * Sets the value of the externalAuthUserId property. 225 | * 226 | * @param value 227 | * allowed object is {@link String } 228 | * 229 | */ 230 | public void setExternalAuthUserId(String value) { 231 | this.externalAuthUserId = value; 232 | } 233 | 234 | } 235 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/ViewListType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.01.30 at 12:49:43 PM PST 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | import javax.xml.bind.annotation.XmlAccessType; 14 | import javax.xml.bind.annotation.XmlAccessorType; 15 | import javax.xml.bind.annotation.XmlType; 16 | 17 | /** 18 | *

19 | * Java class for viewListType complex type. 20 | * 21 | *

22 | * The following schema fragment specifies the expected content contained within 23 | * this class. 24 | * 25 | *

26 |  * <complexType name="viewListType">
27 |  *   <complexContent>
28 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
29 |  *       <sequence>
30 |  *         <element name="view" type="{http://tableausoftware.com/api}viewType" maxOccurs="unbounded" minOccurs="0"/>
31 |  *       </sequence>
32 |  *     </restriction>
33 |  *   </complexContent>
34 |  * </complexType>
35 |  * 
36 | * 37 | * 38 | */ 39 | @XmlAccessorType(XmlAccessType.FIELD) 40 | @XmlType(name = "viewListType", propOrder = { "view" }) 41 | public class ViewListType { 42 | 43 | protected List view; 44 | 45 | /** 46 | * Gets the value of the view property. 47 | * 48 | *

49 | * This accessor method returns a reference to the live list, not a 50 | * snapshot. Therefore any modification you make to the returned list will 51 | * be present inside the JAXB object. This is why there is not a 52 | * set method for the view property. 53 | * 54 | *

55 | * For example, to add a new item, do as follows: 56 | * 57 | *

58 |      * getView().add(newItem);
59 |      * 
60 | * 61 | * 62 | *

63 | * Objects of the following type(s) are allowed in the list {@link ViewType } 64 | * 65 | * 66 | */ 67 | public List getView() { 68 | if (view == null) { 69 | view = new ArrayList(); 70 | } 71 | return this.view; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/ViewType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.01.30 at 12:49:43 PM PST 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import java.math.BigInteger; 11 | 12 | import javax.xml.bind.annotation.XmlAccessType; 13 | import javax.xml.bind.annotation.XmlAccessorType; 14 | import javax.xml.bind.annotation.XmlAttribute; 15 | import javax.xml.bind.annotation.XmlSchemaType; 16 | import javax.xml.bind.annotation.XmlType; 17 | 18 | /** 19 | *

20 | * Java class for viewType complex type. 21 | * 22 | *

23 | * The following schema fragment specifies the expected content contained within 24 | * this class. 25 | * 26 | *

 27 |  * <complexType name="viewType">
 28 |  *   <complexContent>
 29 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 30 |  *       <sequence>
 31 |  *         <element name="usage" minOccurs="0">
 32 |  *           <complexType>
 33 |  *             <complexContent>
 34 |  *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 35 |  *                 <attribute name="totalViewCount" use="required" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" />
 36 |  *               </restriction>
 37 |  *             </complexContent>
 38 |  *           </complexType>
 39 |  *         </element>
 40 |  *       </sequence>
 41 |  *       <attribute name="id" type="{http://tableausoftware.com/api}resourceIdType" />
 42 |  *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
 43 |  *       <attribute name="contentUrl" type="{http://www.w3.org/2001/XMLSchema}string" />
 44 |  *     </restriction>
 45 |  *   </complexContent>
 46 |  * </complexType>
 47 |  * 
48 | * 49 | * 50 | */ 51 | @XmlAccessorType(XmlAccessType.FIELD) 52 | @XmlType(name = "viewType", propOrder = { "usage" }) 53 | public class ViewType { 54 | 55 | protected ViewType.Usage usage; 56 | @XmlAttribute(name = "id") 57 | protected String id; 58 | @XmlAttribute(name = "name") 59 | protected String name; 60 | @XmlAttribute(name = "contentUrl") 61 | protected String contentUrl; 62 | 63 | /** 64 | * Gets the value of the usage property. 65 | * 66 | * @return possible object is {@link ViewType.Usage } 67 | * 68 | */ 69 | public ViewType.Usage getUsage() { 70 | return usage; 71 | } 72 | 73 | /** 74 | * Sets the value of the usage property. 75 | * 76 | * @param value 77 | * allowed object is {@link ViewType.Usage } 78 | * 79 | */ 80 | public void setUsage(ViewType.Usage value) { 81 | this.usage = value; 82 | } 83 | 84 | /** 85 | * Gets the value of the id property. 86 | * 87 | * @return possible object is {@link String } 88 | * 89 | */ 90 | public String getId() { 91 | return id; 92 | } 93 | 94 | /** 95 | * Sets the value of the id property. 96 | * 97 | * @param value 98 | * allowed object is {@link String } 99 | * 100 | */ 101 | public void setId(String value) { 102 | this.id = value; 103 | } 104 | 105 | /** 106 | * Gets the value of the name property. 107 | * 108 | * @return possible object is {@link String } 109 | * 110 | */ 111 | public String getName() { 112 | return name; 113 | } 114 | 115 | /** 116 | * Sets the value of the name property. 117 | * 118 | * @param value 119 | * allowed object is {@link String } 120 | * 121 | */ 122 | public void setName(String value) { 123 | this.name = value; 124 | } 125 | 126 | /** 127 | * Gets the value of the contentUrl property. 128 | * 129 | * @return possible object is {@link String } 130 | * 131 | */ 132 | public String getContentUrl() { 133 | return contentUrl; 134 | } 135 | 136 | /** 137 | * Sets the value of the contentUrl property. 138 | * 139 | * @param value 140 | * allowed object is {@link String } 141 | * 142 | */ 143 | public void setContentUrl(String value) { 144 | this.contentUrl = value; 145 | } 146 | 147 | /** 148 | *

149 | * Java class for anonymous complex type. 150 | * 151 | *

152 | * The following schema fragment specifies the expected content contained 153 | * within this class. 154 | * 155 | *

156 |      * <complexType>
157 |      *   <complexContent>
158 |      *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
159 |      *       <attribute name="totalViewCount" use="required" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" />
160 |      *     </restriction>
161 |      *   </complexContent>
162 |      * </complexType>
163 |      * 
164 | * 165 | * 166 | */ 167 | @XmlAccessorType(XmlAccessType.FIELD) 168 | @XmlType(name = "") 169 | public static class Usage { 170 | 171 | @XmlAttribute(name = "totalViewCount", required = true) 172 | @XmlSchemaType(name = "nonNegativeInteger") 173 | protected BigInteger totalViewCount; 174 | 175 | /** 176 | * Gets the value of the totalViewCount property. 177 | * 178 | * @return possible object is {@link BigInteger } 179 | * 180 | */ 181 | public BigInteger getTotalViewCount() { 182 | return totalViewCount; 183 | } 184 | 185 | /** 186 | * Sets the value of the totalViewCount property. 187 | * 188 | * @param value 189 | * allowed object is {@link BigInteger } 190 | * 191 | */ 192 | public void setTotalViewCount(BigInteger value) { 193 | this.totalViewCount = value; 194 | } 195 | 196 | } 197 | 198 | } 199 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/WorkbookListType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.01.30 at 12:49:43 PM PST 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | import javax.xml.bind.annotation.XmlAccessType; 14 | import javax.xml.bind.annotation.XmlAccessorType; 15 | import javax.xml.bind.annotation.XmlType; 16 | 17 | /** 18 | *

19 | * Java class for workbookListType complex type. 20 | * 21 | *

22 | * The following schema fragment specifies the expected content contained within 23 | * this class. 24 | * 25 | *

26 |  * <complexType name="workbookListType">
27 |  *   <complexContent>
28 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
29 |  *       <sequence>
30 |  *         <element name="workbook" type="{http://tableausoftware.com/api}workbookType" maxOccurs="unbounded" minOccurs="0"/>
31 |  *       </sequence>
32 |  *     </restriction>
33 |  *   </complexContent>
34 |  * </complexType>
35 |  * 
36 | * 37 | * 38 | */ 39 | @XmlAccessorType(XmlAccessType.FIELD) 40 | @XmlType(name = "workbookListType", propOrder = { "workbook" }) 41 | public class WorkbookListType { 42 | 43 | protected List workbook; 44 | 45 | /** 46 | * Gets the value of the workbook property. 47 | * 48 | *

49 | * This accessor method returns a reference to the live list, not a 50 | * snapshot. Therefore any modification you make to the returned list will 51 | * be present inside the JAXB object. This is why there is not a 52 | * set method for the workbook property. 53 | * 54 | *

55 | * For example, to add a new item, do as follows: 56 | * 57 | *

58 |      * getWorkbook().add(newItem);
59 |      * 
60 | * 61 | * 62 | *

63 | * Objects of the following type(s) are allowed in the list 64 | * {@link WorkbookType } 65 | * 66 | * 67 | */ 68 | public List getWorkbook() { 69 | if (workbook == null) { 70 | workbook = new ArrayList(); 71 | } 72 | return this.workbook; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/WorkbookType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.09.21 at 01:55:40 PM PDT 6 | // 7 | 8 | package com.tableausoftware.documentation.api.rest.bindings; 9 | 10 | import javax.xml.bind.annotation.XmlAccessType; 11 | import javax.xml.bind.annotation.XmlAccessorType; 12 | import javax.xml.bind.annotation.XmlAttribute; 13 | import javax.xml.bind.annotation.XmlType; 14 | 15 | /** 16 | *

Java class for workbookType complex type. 17 | * 18 | *

The following schema fragment specifies the expected content contained within this class. 19 | * 20 | *

 21 |  * <complexType name="workbookType">
 22 |  *   <complexContent>
 23 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 24 |  *       <sequence>
 25 |  *         <element name="connectionCredentials" type="{http://tableau.com/api}connectionCredentialsType" minOccurs="0"/>
 26 |  *         <element name="site" type="{http://tableau.com/api}siteType" minOccurs="0"/>
 27 |  *         <element name="project" type="{http://tableau.com/api}projectType" minOccurs="0"/>
 28 |  *         <element name="owner" type="{http://tableau.com/api}userType" minOccurs="0"/>
 29 |  *         <element name="tags" type="{http://tableau.com/api}tagListType" minOccurs="0"/>
 30 |  *         <element name="views" type="{http://tableau.com/api}viewListType" minOccurs="0"/>
 31 |  *       </sequence>
 32 |  *       <attribute name="id" type="{http://tableau.com/api}resourceIdType" />
 33 |  *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
 34 |  *       <attribute name="description" type="{http://www.w3.org/2001/XMLSchema}string" />
 35 |  *       <attribute name="contentUrl" type="{http://www.w3.org/2001/XMLSchema}string" />
 36 |  *       <attribute name="showTabs" type="{http://www.w3.org/2001/XMLSchema}boolean" />
 37 |  *     </restriction>
 38 |  *   </complexContent>
 39 |  * </complexType>
 40 |  * 
41 | * 42 | * 43 | */ 44 | @XmlAccessorType(XmlAccessType.FIELD) 45 | @XmlType(name = "workbookType", propOrder = { 46 | "site", 47 | "project", 48 | "owner", 49 | "tags", 50 | "views" 51 | }) 52 | public class WorkbookType { 53 | 54 | protected SiteType site; 55 | protected ProjectType project; 56 | protected UserType owner; 57 | protected TagListType tags; 58 | protected ViewListType views; 59 | @XmlAttribute(name = "id") 60 | protected String id; 61 | @XmlAttribute(name = "name") 62 | protected String name; 63 | @XmlAttribute(name = "description") 64 | protected String description; 65 | @XmlAttribute(name = "contentUrl") 66 | protected String contentUrl; 67 | @XmlAttribute(name = "showTabs") 68 | protected Boolean showTabs; 69 | 70 | /** 71 | * Gets the value of the site property. 72 | * 73 | * @return 74 | * possible object is 75 | * {@link SiteType } 76 | * 77 | */ 78 | public SiteType getSite() { 79 | return site; 80 | } 81 | 82 | /** 83 | * Sets the value of the site property. 84 | * 85 | * @param value 86 | * allowed object is 87 | * {@link SiteType } 88 | * 89 | */ 90 | public void setSite(SiteType value) { 91 | this.site = value; 92 | } 93 | 94 | /** 95 | * Gets the value of the project property. 96 | * 97 | * @return 98 | * possible object is 99 | * {@link ProjectType } 100 | * 101 | */ 102 | public ProjectType getProject() { 103 | return project; 104 | } 105 | 106 | /** 107 | * Sets the value of the project property. 108 | * 109 | * @param value 110 | * allowed object is 111 | * {@link ProjectType } 112 | * 113 | */ 114 | public void setProject(ProjectType value) { 115 | this.project = value; 116 | } 117 | 118 | /** 119 | * Gets the value of the owner property. 120 | * 121 | * @return 122 | * possible object is 123 | * {@link UserType } 124 | * 125 | */ 126 | public UserType getOwner() { 127 | return owner; 128 | } 129 | 130 | /** 131 | * Sets the value of the owner property. 132 | * 133 | * @param value 134 | * allowed object is 135 | * {@link UserType } 136 | * 137 | */ 138 | public void setOwner(UserType value) { 139 | this.owner = value; 140 | } 141 | 142 | /** 143 | * Gets the value of the tags property. 144 | * 145 | * @return 146 | * possible object is 147 | * {@link TagListType } 148 | * 149 | */ 150 | public TagListType getTags() { 151 | return tags; 152 | } 153 | 154 | /** 155 | * Sets the value of the tags property. 156 | * 157 | * @param value 158 | * allowed object is 159 | * {@link TagListType } 160 | * 161 | */ 162 | public void setTags(TagListType value) { 163 | this.tags = value; 164 | } 165 | 166 | /** 167 | * Gets the value of the views property. 168 | * 169 | * @return 170 | * possible object is 171 | * {@link ViewListType } 172 | * 173 | */ 174 | public ViewListType getViews() { 175 | return views; 176 | } 177 | 178 | /** 179 | * Sets the value of the views property. 180 | * 181 | * @param value 182 | * allowed object is 183 | * {@link ViewListType } 184 | * 185 | */ 186 | public void setViews(ViewListType value) { 187 | this.views = value; 188 | } 189 | 190 | /** 191 | * Gets the value of the id property. 192 | * 193 | * @return 194 | * possible object is 195 | * {@link String } 196 | * 197 | */ 198 | public String getId() { 199 | return id; 200 | } 201 | 202 | /** 203 | * Sets the value of the id property. 204 | * 205 | * @param value 206 | * allowed object is 207 | * {@link String } 208 | * 209 | */ 210 | public void setId(String value) { 211 | this.id = value; 212 | } 213 | 214 | /** 215 | * Gets the value of the name property. 216 | * 217 | * @return 218 | * possible object is 219 | * {@link String } 220 | * 221 | */ 222 | public String getName() { 223 | return name; 224 | } 225 | 226 | /** 227 | * Sets the value of the name property. 228 | * 229 | * @param value 230 | * allowed object is 231 | * {@link String } 232 | * 233 | */ 234 | public void setName(String value) { 235 | this.name = value; 236 | } 237 | 238 | /** 239 | * Gets the value of the description property. 240 | * 241 | * @return 242 | * possible object is 243 | * {@link String } 244 | * 245 | */ 246 | public String getDescription() { 247 | return description; 248 | } 249 | 250 | /** 251 | * Sets the value of the description property. 252 | * 253 | * @param value 254 | * allowed object is 255 | * {@link String } 256 | * 257 | */ 258 | public void setDescription(String value) { 259 | this.description = value; 260 | } 261 | 262 | /** 263 | * Gets the value of the contentUrl property. 264 | * 265 | * @return 266 | * possible object is 267 | * {@link String } 268 | * 269 | */ 270 | public String getContentUrl() { 271 | return contentUrl; 272 | } 273 | 274 | /** 275 | * Sets the value of the contentUrl property. 276 | * 277 | * @param value 278 | * allowed object is 279 | * {@link String } 280 | * 281 | */ 282 | public void setContentUrl(String value) { 283 | this.contentUrl = value; 284 | } 285 | 286 | /** 287 | * Gets the value of the showTabs property. 288 | * 289 | * @return 290 | * possible object is 291 | * {@link Boolean } 292 | * 293 | */ 294 | public Boolean isShowTabs() { 295 | return showTabs; 296 | } 297 | 298 | /** 299 | * Sets the value of the showTabs property. 300 | * 301 | * @param value 302 | * allowed object is 303 | * {@link Boolean } 304 | * 305 | */ 306 | public void setShowTabs(Boolean value) { 307 | this.showTabs = value; 308 | } 309 | 310 | } 311 | -------------------------------------------------------------------------------- /java/src/com/tableausoftware/documentation/api/rest/bindings/package-info.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2015.09.21 at 01:55:40 PM PDT 6 | // 7 | 8 | @javax.xml.bind.annotation.XmlSchema(namespace = "http://tableau.com/api", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) 9 | package com.tableausoftware.documentation.api.rest.bindings; 10 | -------------------------------------------------------------------------------- /postman/Postman-Environment-Tableau-Webhooks.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "cd970550-7659-4f6d-bec5-d593544d532f", 3 | "name": "Tableau Webhooks", 4 | "values": [ 5 | { 6 | "key": "server", 7 | "value": "", 8 | "enabled": true 9 | }, 10 | { 11 | "key": "content-url", 12 | "value": "", 13 | "enabled": true 14 | }, 15 | { 16 | "key": "username", 17 | "value": "", 18 | "enabled": true 19 | }, 20 | { 21 | "key": "password", 22 | "value": "", 23 | "enabled": true 24 | }, 25 | { 26 | "key": "pat-name", 27 | "value": "", 28 | "enabled": true 29 | }, 30 | { 31 | "key": "pat-secret", 32 | "value": "", 33 | "enabled": true 34 | }, 35 | { 36 | "key": "site-id", 37 | "value": "", 38 | "enabled": true 39 | }, 40 | { 41 | "key": "tableau-auth-token", 42 | "value": "", 43 | "enabled": true 44 | }, 45 | { 46 | "key": "webhook-id", 47 | "value": "", 48 | "enabled": true 49 | }, 50 | { 51 | "key": "webhook-name", 52 | "value": "", 53 | "enabled": true 54 | }, 55 | { 56 | "key": "webhook-event", 57 | "value": "", 58 | "enabled": true 59 | }, 60 | { 61 | "key": "webhook-url", 62 | "value": "", 63 | "enabled": true 64 | }, 65 | { 66 | "key": "webhook-isenabled", 67 | "value": "", 68 | "enabled": true 69 | }, 70 | { 71 | "key": "webhook-statuschangereason", 72 | "value": "", 73 | "enabled": true 74 | } 75 | ], 76 | "_postman_variable_scope": "environment", 77 | "_postman_exported_at": "2020-10-28T23:05:27.345Z", 78 | "_postman_exported_using": "Postman/7.32.0" 79 | } -------------------------------------------------------------------------------- /postman/README.md: -------------------------------------------------------------------------------- 1 | # Tableau Webhooks Assets 2 | 3 | This repo contains Postman collection content for accessing Webhooks methods in the Tableau REST API. 4 | 5 | > NOTE: See **[tableau-postman](https://github.com/tableau/tableau-postman/blob/main/README.md)** for a comprehensive Postman collection for the entire Tableau REST API. 6 | 7 | To learn more about the Webhooks feature, see the Tableau Webhooks documentation: 8 | 9 | - [Developer guide](https://help.tableau.com/current/developer/webhooks/en-us/) 10 | 11 | - [REST API Endpoints for Webhooks](https://help.tableau.com/v2020.4/api/rest_api/en-us/REST/rest_api_ref_webhooks.htm) 12 | 13 | To use the Postman collection, you will need to begin with some initial setup 14 | 15 | 1. A Tableau site that you have administrator access to 16 | 2. The id of that site - you can use the [REST API](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_get_started_tutorial_part_1.htm) or the [Tableau Server Client](https://tableau.github.io/server-client-python/) to fetch this 17 | 3. A PAT for the site to log in 18 | 4. A webhook destination - this must be a https URL. If you don't have any server where you can read the request as it arrives, there are many public apps that will work, including 19 | - https://webhook.site 20 | - a project on Glitch (see [existing examples(https://glitch.com/@tableau/webhooks)] 21 | - https://postman-echo.com 22 | - https://requestbin.com/ 23 | 5. Choose an [event](https://help.tableau.com/current/developer/webhooks/en-us/docs/webhooks-events-payload.html#trigger-events) that will trigger your webhook 24 | 6. And finally, a fun name for your new webhook! 25 | -------------------------------------------------------------------------------- /python/README.md: -------------------------------------------------------------------------------- 1 | 2 | Requirements 3 | --------------- 4 | * Python 2.7 or 3.x 5 | * Python 'requests' library (http://docs.python-requests.org/en/latest/) 6 | 7 | Running the samples 8 | --------------- 9 | * All samples can be run using the command prompt or terminal 10 | * All samples require 2 arguments: server adress (without a trailing slash) and username 11 | * Run by executing ```python sample_file_name.py ``` 12 | * Specific information for each sample are included at the top of each file 13 | * API version is set to 3.5 by default for Tableau Server 2019.3, but it can be changed in [version.py](./version.py) 14 | * For Tableau Server 9.0, the REST API namespace must be changed (refer to the comment in each sample where the namespace, `xmlns`, is defined) 15 | 16 | REST API Samples 17 | --------------- 18 | These are created and maintained by Tableau. 19 | 20 | Demo | Source Code | Description 21 | -------- | -------- | -------- 22 | Publish Workbook | [publish_workbook.py](./publish_workbook.py) | Shows how to upload a Tableau workbook using both a single request as well as chunking the upload. 23 | Move Workbook | [move_workbook_projects.py](./move_workbook_projects.py)
[move_workbook_sites.py](./move_workbook_sites.py)
[move_workbook_server.py](./move_workbook_server.py) | Shows how to move a workbook from one project/site/server to another. Moving across different sites and servers require downloading the workbook. Two methods of downloading are demonstrated in the sites and server samples.

Moving to another project uses an API call to update workbook.
Moving to another site uses in-memory download method.
Moving to another server uses a temporary file to download workbook. 24 | Add Permissions | [user_permission_audit.py](./user_permission_audit.py) | Shows how to add permissions for a given user to a given workbook. 25 | Global Workbook Permissions | [update_permission.py](./update_permission.py) | Shows how to add or update user permissions for every workbook on a given site or project. 26 | -------------------------------------------------------------------------------- /python/move_workbook_projects.py: -------------------------------------------------------------------------------- 1 | #### 2 | # This script contains functions that demonstrate how to move 3 | # a workbook from one project to another. 4 | # 5 | # To run the script, you must have installed Python 2.7.9 or later, 6 | # plus the 'requests' library: 7 | # http://docs.python-requests.org/en/latest/ 8 | # 9 | # The script takes in the server address and username as arguments, 10 | # where the server address has no trailing slash (e.g. http://localhost). 11 | # Run the script in terminal by entering: 12 | # python move_workbook_projects.py 13 | # 14 | # When running the script, it will prompt for the following: 15 | # 'Name of workbook to move': Enter name of workbook to move 16 | # 'Destination project': Enter name of project to move workbook into 17 | # 'Password': Enter password for the user to log in as. 18 | #### 19 | 20 | from version import VERSION 21 | import requests # Contains methods used to make HTTP requests 22 | import xml.etree.ElementTree as ET # Contains methods used to build and parse XML 23 | import sys 24 | import math 25 | import getpass 26 | 27 | # The namespace for the REST API is 'http://tableausoftware.com/api' for Tableau Server 9.0 28 | # or 'http://tableau.com/api' for Tableau Server 9.1 or later 29 | xmlns = {'t': 'http://tableau.com/api'} 30 | 31 | # If using python version 3.x, 'raw_input()' is changed to 'input()' 32 | if sys.version[0] == '3': raw_input=input 33 | 34 | 35 | class ApiCallError(Exception): 36 | pass 37 | 38 | 39 | class UserDefinedFieldError(Exception): 40 | pass 41 | 42 | 43 | def _encode_for_display(text): 44 | """ 45 | Encodes strings so they can display as ASCII in a Windows terminal window. 46 | This function also encodes strings for processing by xml.etree.ElementTree functions. 47 | 48 | Returns an ASCII-encoded version of the text. 49 | Unicode characters are converted to ASCII placeholders (for example, "?"). 50 | """ 51 | return text.encode('ascii', errors="backslashreplace").decode('utf-8') 52 | 53 | 54 | def _check_status(server_response, success_code): 55 | """ 56 | Checks the server response for possible errors. 57 | 58 | 'server_response' the response received from the server 59 | 'success_code' the expected success code for the response 60 | Throws an ApiCallError exception if the API call fails. 61 | """ 62 | if server_response.status_code != success_code: 63 | parsed_response = ET.fromstring(server_response.text) 64 | 65 | # Obtain the 3 xml tags from the response: error, summary, and detail tags 66 | error_element = parsed_response.find('t:error', namespaces=xmlns) 67 | summary_element = parsed_response.find('.//t:summary', namespaces=xmlns) 68 | detail_element = parsed_response.find('.//t:detail', namespaces=xmlns) 69 | 70 | # Retrieve the error code, summary, and detail if the response contains them 71 | code = error_element.get('code', 'unknown') if error_element is not None else 'unknown code' 72 | summary = summary_element.text if summary_element is not None else 'unknown summary' 73 | detail = detail_element.text if detail_element is not None else 'unknown detail' 74 | error_message = '{0}: {1} - {2}'.format(code, summary, detail) 75 | raise ApiCallError(error_message) 76 | return 77 | 78 | 79 | def sign_in(server, username, password, site=""): 80 | """ 81 | Signs in to the server specified with the given credentials 82 | 83 | 'server' specified server address 84 | 'name' is the name (not ID) of the user to sign in as. 85 | Note that most of the functions in this example require that the user 86 | have server administrator permissions. 87 | 'password' is the password for the user. 88 | 'site' is the ID (as a string) of the site on the server to sign in to. The 89 | default is "", which signs in to the default site. 90 | Returns the authentication token and the site ID. 91 | """ 92 | url = server + "/api/{0}/auth/signin".format(VERSION) 93 | 94 | # Builds the request 95 | xml_request = ET.Element('tsRequest') 96 | credentials_element = ET.SubElement(xml_request, 'credentials', name=username, password=password) 97 | ET.SubElement(credentials_element, 'site', contentUrl=site) 98 | xml_request = ET.tostring(xml_request) 99 | 100 | # Make the request to server 101 | server_response = requests.post(url, data=xml_request) 102 | _check_status(server_response, 200) 103 | 104 | # ASCII encode server response to enable displaying to console 105 | server_response = _encode_for_display(server_response.text) 106 | 107 | # Reads and parses the response 108 | parsed_response = ET.fromstring(server_response) 109 | 110 | # Gets the auth token and site ID 111 | token = parsed_response.find('t:credentials', namespaces=xmlns).get('token') 112 | site_id = parsed_response.find('.//t:site', namespaces=xmlns).get('id') 113 | user_id = parsed_response.find('.//t:user', namespaces=xmlns).get('id') 114 | return token, site_id, user_id 115 | 116 | 117 | def sign_out(server, auth_token): 118 | """ 119 | Destroys the active session and invalidates authentication token. 120 | 121 | 'server' specified server address 122 | 'auth_token' authentication token that grants user access to API calls 123 | """ 124 | url = server + "/api/{0}/auth/signout".format(VERSION) 125 | server_response = requests.post(url, headers={'x-tableau-auth': auth_token}) 126 | _check_status(server_response, 204) 127 | return 128 | 129 | 130 | def get_workbook_id(server, auth_token, user_id, site_id, workbook_name): 131 | """ 132 | Gets the id of the desired workbook to relocate. 133 | 134 | 'server' specified server address 135 | 'auth_token' authentication token that grants user access to API calls 136 | 'user_id' ID of user with access to workbook 137 | 'site_id' ID of the site that the user is signed into 138 | 'workbook_name' name of workbook to get ID of 139 | Returns the workbook id and the project id that contains the workbook. 140 | """ 141 | url = server + "/api/{0}/sites/{1}/users/{2}/workbooks".format(VERSION, site_id, user_id) 142 | server_response = requests.get(url, headers={'x-tableau-auth': auth_token}) 143 | _check_status(server_response, 200) 144 | xml_response = ET.fromstring(_encode_for_display(server_response.text)) 145 | 146 | workbooks = xml_response.findall('.//t:workbook', namespaces=xmlns) 147 | for workbook in workbooks: 148 | if workbook.get('name') == workbook_name: 149 | source_project_id = workbook.find('.//t:project', namespaces=xmlns).get('id') 150 | return source_project_id, workbook.get('id') 151 | error = "Workbook named '{0}' not found.".format(workbook_name) 152 | raise LookupError(error) 153 | 154 | 155 | def get_project_id(server, auth_token, site_id, dest_project): 156 | """ 157 | Returns the project ID of the desired project 158 | 159 | 'server' specified server address 160 | 'auth_token' authentication token that grants user access to API calls 161 | 'site_id' ID of the site that the user is signed into 162 | 'dest_project' name of destination project to get ID of 163 | """ 164 | page_num, page_size = 1, 100 # Default paginating values 165 | 166 | # Builds the request 167 | url = server + "/api/{0}/sites/{1}/projects".format(VERSION, site_id) 168 | paged_url = url + "?pageSize={0}&pageNumber={1}".format(page_size, page_num) 169 | server_response = requests.get(paged_url, headers={'x-tableau-auth': auth_token}) 170 | _check_status(server_response, 200) 171 | xml_response = ET.fromstring(_encode_for_display(server_response.text)) 172 | 173 | # Used to determine if more requests are required to find all projects on server 174 | total_projects = int(xml_response.find('t:pagination', namespaces=xmlns).get('totalAvailable')) 175 | max_page = int(math.ceil(total_projects / page_size)) 176 | 177 | projects = xml_response.findall('.//t:project', namespaces=xmlns) 178 | 179 | # Continue querying if more projects exist on the server 180 | for page in range(2, max_page + 1): 181 | paged_url = url + "?pageSize={0}&pageNumber={1}".format(page_size, page) 182 | server_response = requests.get(paged_url, headers={'x-tableau-auth': auth_token}) 183 | _check_status(server_response, 200) 184 | xml_response = ET.fromstring(_encode_for_display(server_response.text)) 185 | projects.extend(xml_response.findall('.//t:project', namespaces=xmlns)) 186 | 187 | # Look through all projects to find the 'default' one 188 | for project in projects: 189 | if project.get('name') == dest_project: 190 | return project.get('id') 191 | error = "Project named '{0}' was not found on server".format(dest_project) 192 | raise LookupError(error) 193 | 194 | 195 | def move_workbook(server, auth_token, site_id, workbook_id, project_id): 196 | """ 197 | Moves the specified workbook to another project. 198 | 199 | 'server' specified server address 200 | 'auth_token' authentication token that grants user access to API calls 201 | 'site_id' ID of the site that the user is signed into 202 | 'workbook_id' ID of the workbook to move 203 | 'project_id' ID of the project to move workbook into 204 | """ 205 | url = server + "/api/{0}/sites/{1}/workbooks/{2}".format(VERSION, site_id, workbook_id) 206 | # Build the request to move workbook 207 | xml_request = ET.Element('tsRequest') 208 | workbook_element = ET.SubElement(xml_request, 'workbook') 209 | ET.SubElement(workbook_element, 'project', id=project_id) 210 | xml_request = ET.tostring(xml_request) 211 | 212 | server_response = requests.put(url, data=xml_request, headers={'x-tableau-auth': auth_token}) 213 | _check_status(server_response, 200) 214 | 215 | 216 | def main(): 217 | ##### STEP 0: INITIALIZATION ##### 218 | if len(sys.argv) != 3: 219 | error = "2 arguments needed (server, username)" 220 | raise UserDefinedFieldError(error) 221 | server = sys.argv[1] 222 | username = sys.argv[2] 223 | workbook_name = raw_input("\nName of workbook to move: ") 224 | dest_project = raw_input("\nDestination project: ") 225 | 226 | print("\n*Moving '{0}' workbook to '{1}' project as {2}*".format(workbook_name, dest_project, username)) 227 | password = getpass.getpass("Password: ") 228 | 229 | ##### STEP 1: Sign in ##### 230 | print("\n1. Signing in as " + username) 231 | auth_token, site_id, user_id = sign_in(server, username, password) 232 | 233 | ##### STEP 2: Find new project id ##### 234 | print("\n2. Finding project id of '{0}'".format(dest_project)) 235 | dest_project_id = get_project_id(server, auth_token, site_id, dest_project) 236 | 237 | ##### STEP 3: Find workbook id ##### 238 | print("\n3. Finding workbook id of '{0}'".format(workbook_name)) 239 | source_project_id, workbook_id = get_workbook_id(server, auth_token, user_id, site_id, workbook_name) 240 | 241 | # Check if the workbook is already in the desired project 242 | if source_project_id == dest_project_id: 243 | error = "Workbook already in destination project" 244 | raise UserDefinedFieldError(error) 245 | 246 | ##### STEP 4: Move workbook ##### 247 | print("\n4. Moving workbook to '{0}'".format(dest_project)) 248 | move_workbook(server, auth_token, site_id, workbook_id, dest_project_id) 249 | 250 | ##### STEP 5: Sign out ##### 251 | print("\n5. Signing out and invalidating the authentication token") 252 | sign_out(server, auth_token) 253 | 254 | 255 | if __name__ == "__main__": 256 | main() 257 | -------------------------------------------------------------------------------- /python/publish_workbook.py: -------------------------------------------------------------------------------- 1 | #### 2 | # This script contains functions that demonstrate how to publish 3 | # a workbook using the Tableau Server REST API. It will publish a 4 | # specified workbook to the 'default' project of a given server. 5 | # 6 | # Note: The REST API publish process cannot automatically include 7 | # extracts or other resources that the workbook uses. Therefore, 8 | # a .twb file with data from a local computer cannot be published. 9 | # For simplicity, this sample will only accept a .twbx file to publish. 10 | # 11 | # For more information, refer to the documentations on 'Publish Workbook' 12 | # (https://onlinehelp.tableau.com/current/api/rest_api/en-us/help.htm) 13 | # 14 | # To run the script, you must have installed Python 2.7.9 or later, 15 | # plus the 'requests' library: 16 | # http://docs.python-requests.org/en/latest/ 17 | # 18 | # The script takes in the server address and username as arguments, 19 | # where the server address has no trailing slash (e.g. http://localhost). 20 | # Run the script in terminal by entering: 21 | # python publish_sample.py 22 | # 23 | # When running the script, it will prompt for the following: 24 | # 'Workbook file to publish': Enter file path to the desired workbook file 25 | # to publish (.twbx file). 26 | # 'Password': Enter password for the user to log in as. 27 | #### 28 | 29 | from version import VERSION 30 | import requests # Contains methods used to make HTTP requests 31 | import xml.etree.ElementTree as ET # Contains methods used to build and parse XML 32 | import sys 33 | import os 34 | import math 35 | import getpass 36 | 37 | # The following packages are used to build a multi-part/mixed request. 38 | # They are contained in the 'requests' library 39 | from requests.packages.urllib3.fields import RequestField 40 | from requests.packages.urllib3.filepost import encode_multipart_formdata 41 | 42 | # The namespace for the REST API is 'http://tableausoftware.com/api' for Tableau Server 9.0 43 | # or 'http://tableau.com/api' for Tableau Server 9.1 or later 44 | xmlns = {'t': 'http://tableau.com/api'} 45 | 46 | # The maximum size of a file that can be published in a single request is 64MB 47 | FILESIZE_LIMIT = 1024 * 1024 * 64 # 64MB 48 | 49 | # For when a workbook is over 64MB, break it into 5MB(standard chunk size) chunks 50 | CHUNK_SIZE = 1024 * 1024 * 5 # 5MB 51 | 52 | # If using python version 3.x, 'raw_input()' is changed to 'input()' 53 | if sys.version[0] == '3': raw_input=input 54 | 55 | 56 | class ApiCallError(Exception): 57 | pass 58 | 59 | 60 | class UserDefinedFieldError(Exception): 61 | pass 62 | 63 | 64 | def _encode_for_display(text): 65 | """ 66 | Encodes strings so they can display as ASCII in a Windows terminal window. 67 | This function also encodes strings for processing by xml.etree.ElementTree functions. 68 | 69 | Returns an ASCII-encoded version of the text. 70 | Unicode characters are converted to ASCII placeholders (for example, "?"). 71 | """ 72 | return text.encode('ascii', errors="backslashreplace").decode('utf-8') 73 | 74 | 75 | def _make_multipart(parts): 76 | """ 77 | Creates one "chunk" for a multi-part upload 78 | 79 | 'parts' is a dictionary that provides key-value pairs of the format name: (filename, body, content_type). 80 | 81 | Returns the post body and the content type string. 82 | 83 | For more information, see this post: 84 | http://stackoverflow.com/questions/26299889/how-to-post-multipart-list-of-json-xml-files-using-python-requests 85 | """ 86 | mime_multipart_parts = [] 87 | for name, (filename, blob, content_type) in parts.items(): 88 | multipart_part = RequestField(name=name, data=blob, filename=filename) 89 | multipart_part.make_multipart(content_type=content_type) 90 | mime_multipart_parts.append(multipart_part) 91 | 92 | post_body, content_type = encode_multipart_formdata(mime_multipart_parts) 93 | content_type = ''.join(('multipart/mixed',) + content_type.partition(';')[1:]) 94 | return post_body, content_type 95 | 96 | 97 | def _check_status(server_response, success_code): 98 | """ 99 | Checks the server response for possible errors. 100 | 101 | 'server_response' the response received from the server 102 | 'success_code' the expected success code for the response 103 | Throws an ApiCallError exception if the API call fails. 104 | """ 105 | if server_response.status_code != success_code: 106 | parsed_response = ET.fromstring(server_response.text) 107 | 108 | # Obtain the 3 xml tags from the response: error, summary, and detail tags 109 | error_element = parsed_response.find('t:error', namespaces=xmlns) 110 | summary_element = parsed_response.find('.//t:summary', namespaces=xmlns) 111 | detail_element = parsed_response.find('.//t:detail', namespaces=xmlns) 112 | 113 | # Retrieve the error code, summary, and detail if the response contains them 114 | code = error_element.get('code', 'unknown') if error_element is not None else 'unknown code' 115 | summary = summary_element.text if summary_element is not None else 'unknown summary' 116 | detail = detail_element.text if detail_element is not None else 'unknown detail' 117 | error_message = '{0}: {1} - {2}'.format(code, summary, detail) 118 | raise ApiCallError(error_message) 119 | return 120 | 121 | 122 | def sign_in(server, username, password, site=""): 123 | """ 124 | Signs in to the server specified with the given credentials 125 | 126 | 'server' specified server address 127 | 'username' is the name (not ID) of the user to sign in as. 128 | Note that most of the functions in this example require that the user 129 | have server administrator permissions. 130 | 'password' is the password for the user. 131 | 'site' is the ID (as a string) of the site on the server to sign in to. The 132 | default is "", which signs in to the default site. 133 | Returns the authentication token and the site ID. 134 | """ 135 | url = server + "/api/{0}/auth/signin".format(VERSION) 136 | 137 | # Builds the request 138 | xml_request = ET.Element('tsRequest') 139 | credentials_element = ET.SubElement(xml_request, 'credentials', name=username, password=password) 140 | ET.SubElement(credentials_element, 'site', contentUrl=site) 141 | xml_request = ET.tostring(xml_request) 142 | 143 | # Make the request to server 144 | server_response = requests.post(url, data=xml_request) 145 | _check_status(server_response, 200) 146 | 147 | # ASCII encode server response to enable displaying to console 148 | server_response = _encode_for_display(server_response.text) 149 | 150 | # Reads and parses the response 151 | parsed_response = ET.fromstring(server_response) 152 | 153 | # Gets the auth token and site ID 154 | token = parsed_response.find('t:credentials', namespaces=xmlns).get('token') 155 | site_id = parsed_response.find('.//t:site', namespaces=xmlns).get('id') 156 | return token, site_id 157 | 158 | 159 | def sign_out(server, auth_token): 160 | """ 161 | Destroys the active session and invalidates authentication token. 162 | 163 | 'server' specified server address 164 | 'auth_token' authentication token that grants user access to API calls 165 | """ 166 | url = server + "/api/{0}/auth/signout".format(VERSION) 167 | server_response = requests.post(url, headers={'x-tableau-auth': auth_token}) 168 | _check_status(server_response, 204) 169 | return 170 | 171 | 172 | def start_upload_session(server, auth_token, site_id): 173 | """ 174 | Creates a POST request that initiates a file upload session. 175 | 176 | 'server' specified server address 177 | 'auth_token' authentication token that grants user access to API calls 178 | 'site_id' ID of the site that the user is signed into 179 | Returns a session ID that is used by subsequent functions to identify the upload session. 180 | """ 181 | url = server + "/api/{0}/sites/{1}/fileUploads".format(VERSION, site_id) 182 | server_response = requests.post(url, headers={'x-tableau-auth': auth_token}) 183 | _check_status(server_response, 201) 184 | xml_response = ET.fromstring(_encode_for_display(server_response.text)) 185 | return xml_response.find('t:fileUpload', namespaces=xmlns).get('uploadSessionId') 186 | 187 | 188 | def get_default_project_id(server, auth_token, site_id): 189 | """ 190 | Returns the project ID for the 'default' project on the Tableau server. 191 | 192 | 'server' specified server address 193 | 'auth_token' authentication token that grants user access to API calls 194 | 'site_id' ID of the site that the user is signed into 195 | """ 196 | page_num, page_size = 1, 100 # Default paginating values 197 | 198 | # Builds the request 199 | url = server + "/api/{0}/sites/{1}/projects".format(VERSION, site_id) 200 | paged_url = url + "?pageSize={0}&pageNumber={1}".format(page_size, page_num) 201 | server_response = requests.get(paged_url, headers={'x-tableau-auth': auth_token}) 202 | _check_status(server_response, 200) 203 | xml_response = ET.fromstring(_encode_for_display(server_response.text)) 204 | 205 | # Used to determine if more requests are required to find all projects on server 206 | total_projects = int(xml_response.find('t:pagination', namespaces=xmlns).get('totalAvailable')) 207 | max_page = int(math.ceil(total_projects / page_size)) 208 | 209 | projects = xml_response.findall('.//t:project', namespaces=xmlns) 210 | 211 | # Continue querying if more projects exist on the server 212 | for page in range(2, max_page + 1): 213 | paged_url = url + "?pageSize={0}&pageNumber={1}".format(page_size, page) 214 | server_response = requests.get(paged_url, headers={'x-tableau-auth': auth_token}) 215 | _check_status(server_response, 200) 216 | xml_response = ET.fromstring(_encode_for_display(server_response.text)) 217 | projects.extend(xml_response.findall('.//t:project', namespaces=xmlns)) 218 | 219 | # Look through all projects to find the 'default' one 220 | for project in projects: 221 | if project.get('name') == 'default' or project.get('name') == 'Default': 222 | return project.get('id') 223 | raise LookupError("Project named 'default' was not found on server") 224 | 225 | 226 | def main(): 227 | ##### STEP 0: INITIALIZATION ##### 228 | if len(sys.argv) != 3: 229 | error = "2 arguments needed (server, username)" 230 | raise UserDefinedFieldError(error) 231 | server = sys.argv[1] 232 | username = sys.argv[2] 233 | workbook_file_path = raw_input("\nWorkbook file to publish (include file extension): ") 234 | workbook_file_path = os.path.abspath(workbook_file_path) 235 | 236 | # Workbook file with extension, without full path 237 | workbook_file = os.path.basename(workbook_file_path) 238 | 239 | print("\n*Publishing '{0}' to the default project as {1}*".format(workbook_file, username)) 240 | password = getpass.getpass("Password: ") 241 | 242 | if not os.path.isfile(workbook_file_path): 243 | error = "{0}: file not found".format(workbook_file_path) 244 | raise IOError(error) 245 | 246 | # Break workbook file by name and extension 247 | workbook_filename, file_extension = workbook_file.split('.', 1) 248 | 249 | if file_extension != 'twbx': 250 | error = "This sample only accepts .twbx files to publish. More information in file comments." 251 | raise UserDefinedFieldError(error) 252 | 253 | # Get workbook size to check if chunking is necessary 254 | workbook_size = os.path.getsize(workbook_file_path) 255 | chunked = workbook_size >= FILESIZE_LIMIT 256 | 257 | ##### STEP 1: SIGN IN ##### 258 | print("\n1. Signing in as " + username) 259 | auth_token, site_id = sign_in(server, username, password) 260 | 261 | ##### STEP 2: OBTAIN DEFAULT PROJECT ID ##### 262 | print("\n2. Finding the 'default' project to publish to") 263 | project_id = get_default_project_id(server, auth_token, site_id) 264 | 265 | ##### STEP 3: PUBLISH WORKBOOK ###### 266 | # Build a general request for publishing 267 | xml_request = ET.Element('tsRequest') 268 | workbook_element = ET.SubElement(xml_request, 'workbook', name=workbook_filename) 269 | ET.SubElement(workbook_element, 'project', id=project_id) 270 | xml_request = ET.tostring(xml_request) 271 | 272 | if chunked: 273 | print("\n3. Publishing '{0}' in {1}MB chunks (workbook over 64MB)".format(workbook_file, CHUNK_SIZE / 1024000)) 274 | # Initiates an upload session 275 | uploadID = start_upload_session(server, auth_token, site_id) 276 | 277 | # URL for PUT request to append chunks for publishing 278 | put_url = server + "/api/{0}/sites/{1}/fileUploads/{2}".format(VERSION, site_id, uploadID) 279 | 280 | # Read the contents of the file in chunks of 100KB 281 | with open(workbook_file_path, 'rb') as f: 282 | while True: 283 | data = f.read(CHUNK_SIZE) 284 | if not data: 285 | break 286 | payload, content_type = _make_multipart({'request_payload': ('', '', 'text/xml'), 287 | 'tableau_file': ('file', data, 'application/octet-stream')}) 288 | print("\tPublishing a chunk...") 289 | server_response = requests.put(put_url, data=payload, 290 | headers={'x-tableau-auth': auth_token, "content-type": content_type}) 291 | _check_status(server_response, 200) 292 | 293 | # Finish building request for chunking method 294 | payload, content_type = _make_multipart({'request_payload': ('', xml_request, 'text/xml')}) 295 | 296 | publish_url = server + "/api/{0}/sites/{1}/workbooks".format(VERSION, site_id) 297 | publish_url += "?uploadSessionId={0}".format(uploadID) 298 | publish_url += "&workbookType={0}&overwrite=true".format(file_extension) 299 | else: 300 | print("\n3. Publishing '" + workbook_file + "' using the all-in-one method (workbook under 64MB)") 301 | # Read the contents of the file to publish 302 | with open(workbook_file_path, 'rb') as f: 303 | workbook_bytes = f.read() 304 | 305 | # Finish building request for all-in-one method 306 | parts = {'request_payload': ('', xml_request, 'text/xml'), 307 | 'tableau_workbook': (workbook_file, workbook_bytes, 'application/octet-stream')} 308 | payload, content_type = _make_multipart(parts) 309 | 310 | publish_url = server + "/api/{0}/sites/{1}/workbooks".format(VERSION, site_id) 311 | publish_url += "?workbookType={0}&overwrite=true".format(file_extension) 312 | 313 | # Make the request to publish and check status code 314 | print("\tUploading...") 315 | server_response = requests.post(publish_url, data=payload, 316 | headers={'x-tableau-auth': auth_token, 'content-type': content_type}) 317 | _check_status(server_response, 201) 318 | 319 | ##### STEP 4: SIGN OUT ##### 320 | print("\n4. Signing out, and invalidating the authentication token") 321 | sign_out(server, auth_token) 322 | auth_token = None 323 | 324 | 325 | if __name__ == '__main__': 326 | main() 327 | -------------------------------------------------------------------------------- /python/update_permission.py: -------------------------------------------------------------------------------- 1 | #### 2 | # This script contains functions that demonstrate how to add or 3 | # update a given permission for a user on all workbooks. If the particular 4 | # permission is already defined with another mode, it will delete 5 | # the old mode and add the permission with the new mode. 6 | # If the particular permission is not already set, it will add 7 | # the permission with the given mode. 8 | # 9 | # To run the script, you must have installed Python 2.7.9 or later, 10 | # plus the 'requests' library: 11 | # http://docs.python-requests.org/en/latest/ 12 | # 13 | # The script takes in the server address and username as arguments, 14 | # where the server address has no trailing slash (e.g. http://localhost). 15 | # Run the script in terminal by entering: 16 | # python publish_sample.py 17 | # 18 | # When running the script, it will prompt for the following: 19 | # 'Username to update permission for': Enter username to update permissions for 20 | # 'Permission to update': Enter name of permission to update 21 | # 'Mode to set permission': Enter either 'Allow' or 'Deny' to set the permission mode 22 | # 'Password': Enter password for the user to log in as. 23 | # 24 | # Possible permission names: 25 | # Read, Write, Filter, AddComment, ViewComments, ShareView, ExportData, ViewUnderlyingData, 26 | # ExportImage, Delete, ChangeHierarchy, ChangePermissions, WebAuthoring, ExportXml 27 | # 28 | # Possible permission modes: 29 | # Allow, Deny 30 | #### 31 | 32 | from version import VERSION 33 | import requests # Contains methods used to make HTTP requests 34 | import xml.etree.ElementTree as ET # Contains methods used to build and parse XML 35 | import sys 36 | import getpass 37 | 38 | # The namespace for the REST API is 'http://tableausoftware.com/api' for Tableau Server 9.0 39 | # or 'http://tableau.com/api' for Tableau Server 9.1 or later 40 | xmlns = {'t': 'http://tableau.com/api'} 41 | 42 | # All possible permission names 43 | permissions = {"Read", "Write", "Filter", "AddComment", "ViewComments", "ShareView", "ExportData", "ViewUnderlyingData", 44 | "ExportImage", "Delete", "ChangeHierarchy", "ChangePermissions", "WebAuthoring", "ExportXml"} 45 | 46 | # Possible modes for to set the permissions 47 | modes = {"Allow", "Deny"} 48 | 49 | # If using python version 3.x, 'raw_input()' is changed to 'input()' 50 | if sys.version[0] == '3': raw_input=input 51 | 52 | 53 | class ApiCallError(Exception): 54 | pass 55 | 56 | 57 | class UserDefinedFieldError(Exception): 58 | pass 59 | 60 | 61 | def _encode_for_display(text): 62 | """ 63 | Encodes strings so they can display as ASCII in a Windows terminal window. 64 | This function also encodes strings for processing by xml.etree.ElementTree functions. 65 | 66 | Returns an ASCII-encoded version of the text. 67 | Unicode characters are converted to ASCII placeholders (for example, "?"). 68 | """ 69 | return text.encode('ascii', errors="backslashreplace").decode('utf-8') 70 | 71 | 72 | def _check_status(server_response, success_code): 73 | """ 74 | Checks the server response for possible errors. 75 | 76 | 'server_response' the response received from the server 77 | 'success_code' the expected success code for the response 78 | Throws an ApiCallError exception if the API call fails. 79 | """ 80 | if server_response.status_code != success_code: 81 | parsed_response = ET.fromstring(server_response.text) 82 | 83 | # Obtain the 3 xml tags from the response: error, summary, and detail tags 84 | error_element = parsed_response.find('t:error', namespaces=xmlns) 85 | summary_element = parsed_response.find('.//t:summary', namespaces=xmlns) 86 | detail_element = parsed_response.find('.//t:detail', namespaces=xmlns) 87 | 88 | # Retrieve the error code, summary, and detail if the response contains them 89 | code = error_element.get('code', 'unknown') if error_element is not None else 'unknown code' 90 | summary = summary_element.text if summary_element is not None else 'unknown summary' 91 | detail = detail_element.text if detail_element is not None else 'unknown detail' 92 | error_message = '{0}: {1} - {2}'.format(code, summary, detail) 93 | raise ApiCallError(error_message) 94 | return 95 | 96 | 97 | def sign_in(server, username, password, site=""): 98 | """ 99 | Signs in to the server specified with the given credentials 100 | 101 | 'server' specified server address 102 | 'username' is the name (not ID) of the user to sign in as. 103 | Note that most of the functions in this example require that the user 104 | have server administrator permissions. 105 | 'password' is the password for the user. 106 | 'site' is the ID (as a string) of the site on the server to sign in to. The 107 | default is "", which signs in to the default site. 108 | Returns the authentication token and the site ID. 109 | """ 110 | url = server + "/api/{0}/auth/signin".format(VERSION) 111 | 112 | # Builds the request 113 | xml_request = ET.Element('tsRequest') 114 | credentials_element = ET.SubElement(xml_request, 'credentials', name=username, password=password) 115 | ET.SubElement(credentials_element, 'site', contentUrl=site) 116 | xml_request = ET.tostring(xml_request) 117 | 118 | # Make the request to server 119 | server_response = requests.post(url, data=xml_request) 120 | _check_status(server_response, 200) 121 | 122 | # ASCII encode server response to enable displaying to console 123 | server_response = _encode_for_display(server_response.text) 124 | 125 | # Reads and parses the response 126 | parsed_response = ET.fromstring(server_response) 127 | 128 | # Gets the auth token and site ID 129 | token = parsed_response.find('t:credentials', namespaces=xmlns).get('token') 130 | site_id = parsed_response.find('.//t:site', namespaces=xmlns).get('id') 131 | user_id = parsed_response.find('.//t:user', namespaces=xmlns).get('id') 132 | return token, site_id, user_id 133 | 134 | 135 | def sign_out(server, auth_token): 136 | """ 137 | Destroys the active session and invalidates authentication token. 138 | 139 | 'server' specified server address 140 | 'auth_token' authentication token that grants user access to API calls 141 | """ 142 | url = server + "/api/{0}/auth/signout".format(VERSION) 143 | server_response = requests.post(url, headers={'x-tableau-auth': auth_token}) 144 | _check_status(server_response, 204) 145 | return 146 | 147 | 148 | def get_user_id(server, auth_token, site_id, username_to_update): 149 | """ 150 | Returns the user id of the user to update permissions for, if found. 151 | 152 | 'server' specified server address 153 | 'auth_token' authentication token that grants user access to API calls 154 | 'site_id' ID of the site that the user is signed into 155 | 'username_to_update' username to update permission for on server 156 | """ 157 | url = server + "/api/{0}/sites/{1}/users".format(VERSION, site_id) 158 | server_response = requests.get(url, headers={'x-tableau-auth': auth_token}) 159 | _check_status(server_response, 200) 160 | server_response = ET.fromstring(_encode_for_display(server_response.text)) 161 | 162 | # Find all user tags in the response and look for matching id 163 | users = server_response.findall('.//t:user', namespaces=xmlns) 164 | for user in users: 165 | if user.get('name') == username_to_update: 166 | return user.get('id') 167 | error = "User id for {0} not found".format(username_to_update) 168 | raise LookupError(error) 169 | 170 | 171 | def get_workbooks(server, auth_token, user_id, site_id): 172 | """ 173 | Queries all existing workbooks on the current site. 174 | 175 | 'server' specified server address 176 | 'auth_token' authentication token that grants user access to API calls 177 | 'user_id' ID of user with access to workbooks 178 | 'site_id' ID of the site that the user is signed into 179 | Returns tuples for each workbook, containing its id and name. 180 | """ 181 | url = server + "/api/{0}/sites/{1}/users/{2}/workbooks".format(VERSION, site_id, user_id) 182 | server_response = requests.get(url, headers={'x-tableau-auth': auth_token}) 183 | _check_status(server_response, 200) 184 | server_response = ET.fromstring(_encode_for_display(server_response.text)) 185 | 186 | # Find all workbook ids 187 | workbook_tags = server_response.findall('.//t:workbook', namespaces=xmlns) 188 | 189 | # Tuples to store each workbook information:(workbook_id, workbook_name) 190 | workbooks = [(workbook.get('id'), workbook.get('name')) for workbook in workbook_tags] 191 | if len(workbooks) == 0: 192 | error = "No workbooks found on this site" 193 | raise LookupError(error) 194 | return workbooks 195 | 196 | 197 | def query_permission(server, auth_token, site_id, workbook_id, user_id): 198 | """ 199 | Returns a list of all permissions for the specified user. 200 | 201 | 'server' specified server address 202 | 'auth_token' authentication token that grants user access to API calls 203 | 'site_id' ID of the site that the user is signed into 204 | 'workbook_id' ID of workbook to update permission in 205 | 'user_id' ID of the user to update 206 | """ 207 | url = server + "/api/{0}/sites/{1}/workbooks/{2}/permissions".format(VERSION, site_id, workbook_id) 208 | server_response = requests.get(url, headers={'x-tableau-auth': auth_token}) 209 | _check_status(server_response, 200) 210 | server_response = _encode_for_display(server_response.text) 211 | 212 | # Reads and parses the response 213 | parsed_response = ET.fromstring(server_response) 214 | 215 | # Find all the capabilities for a specific user 216 | capabilities = parsed_response.findall('.//t:granteeCapabilities', namespaces=xmlns) 217 | for capability in capabilities: 218 | user = capability.find('.//t:user', namespaces=xmlns) 219 | if user is not None and user.get('id') == user_id: 220 | return capability.findall('.//t:capability', namespaces=xmlns) 221 | return None 222 | 223 | 224 | def add_permission(server, auth_token, site_id, workbook_id, user_id, permission_name, permission_mode): 225 | """ 226 | Adds the specified permission to the workbook for the desired user. 227 | 228 | 'server' specified server address 229 | 'auth_token' authentication token that grants user access to API calls 230 | 'site_id' ID of the site that the user is signed into 231 | 'workbook_id' ID of workbook to update permission in 232 | 'user_id' ID of the user to update 233 | 'permission_name' name of permission to add or update 234 | 'permission_mode' mode to set the permission 235 | """ 236 | url = server + "/api/{0}/sites/{1}/workbooks/{2}/permissions".format(VERSION, site_id, workbook_id) 237 | 238 | # Build the request 239 | xml_request = ET.Element('tsRequest') 240 | permissions_element = ET.SubElement(xml_request, 'permissions') 241 | ET.SubElement(permissions_element, 'workbook', id=workbook_id) 242 | grantee_element = ET.SubElement(permissions_element, 'granteeCapabilities') 243 | ET.SubElement(grantee_element, 'user', id=user_id) 244 | capabilities_element = ET.SubElement(grantee_element, 'capabilities') 245 | ET.SubElement(capabilities_element, 'capability', name=permission_name, mode=permission_mode) 246 | xml_request = ET.tostring(xml_request) 247 | 248 | server_request = requests.put(url, data=xml_request, headers={'x-tableau-auth': auth_token}) 249 | _check_status(server_request, 200) 250 | return 251 | 252 | 253 | def delete_permission(server, auth_token, site_id, workbook_id, user_id, permission_name, existing_mode): 254 | """ 255 | Deletes a specific permission from the workbook. 256 | 257 | 'server' specified server address 258 | 'auth_token' authentication token that grants user access to API calls 259 | 'site_id' ID of the site that the user is signed into 260 | 'workbook_id' ID of workbook to update permission in 261 | 'user_id' ID of the user to update 262 | 'permission_name' name of permission to update 263 | 'existing_mode' is the existing mode for the permission 264 | """ 265 | url = server + "/api/{0}/sites/{1}/workbooks/{2}/permissions/users/{3}/{4}/{5}".format(VERSION, 266 | site_id, 267 | workbook_id, 268 | user_id, 269 | permission_name, 270 | existing_mode) 271 | print("\tDeleting existing permission") 272 | server_response = requests.delete(url, headers={'x-tableau-auth': auth_token}) 273 | _check_status(server_response, 204) 274 | return 275 | 276 | 277 | def main(): 278 | ##### STEP 0: Initialization ##### 279 | if len(sys.argv) != 3: 280 | error = "2 arguments needed (server, username)" 281 | raise UserDefinedFieldError(error) 282 | server = sys.argv[1] 283 | server_username = sys.argv[2] 284 | username_to_update = raw_input("\nUsername to update permissions for: ") 285 | permission_name = raw_input("\nPermission to update: ") 286 | permission_mode = raw_input("\nPermission mode (Allow/Deny): ") 287 | 288 | if permission_name not in permissions: 289 | error = "Not a valid permission name" 290 | raise UserDefinedFieldError(error) 291 | 292 | if permission_mode not in modes: 293 | error = "Not a valid permission mode" 294 | raise UserDefinedFieldError(error) 295 | 296 | print("\n*Updating permission to {0} for {1}*".format(permission_name, username_to_update)) 297 | password = getpass.getpass("Password for {0}: ".format(server_username)) 298 | 299 | ##### STEP 1: Sign in ##### 300 | print("\n1. Signing in as " + server_username) 301 | auth_token, site_id, user_id = sign_in(server, server_username, password) 302 | 303 | ##### STEP 2: Find id of username to update ##### 304 | print("\n2. Finding user if of {0}".format(username_to_update)) 305 | user_id = get_user_id(server, auth_token, site_id, username_to_update) 306 | 307 | ##### STEP 3: Find all workbooks in site ##### 308 | print("\n3. Finding all the workbooks in the site") 309 | workbook_ids = get_workbooks(server, auth_token, user_id, site_id) 310 | 311 | ##### STEP 4: Query permissions ##### 312 | print("\n4. Querying permissions for all workbooks and adding specified permission") 313 | for workbook_id, workbook_name in workbook_ids: 314 | user_permissions = query_permission(server, auth_token, site_id, workbook_id, user_id) 315 | if user_permissions is None: 316 | add_permission(server, auth_token, site_id, workbook_id, 317 | user_id, permission_name, permission_mode) 318 | print("\tSuccessfully added/updated permission in {0}\n".format(workbook_name)) 319 | else: 320 | update_permission = True 321 | for permission in user_permissions: 322 | if permission.get('name') == permission_name: 323 | if permission.get('mode') != permission_mode: 324 | existing_mode = permission.get('mode') 325 | delete_permission(server, auth_token, site_id, workbook_id, 326 | user_id, permission_name, existing_mode) 327 | else: 328 | update_permission = False 329 | if update_permission: 330 | add_permission(server, auth_token, site_id, workbook_id, user_id, 331 | permission_name, permission_mode) 332 | print("\tSuccessfully added/updated permission in {0}\n".format(workbook_name)) 333 | else: 334 | print("\tPermission already set to {0} on {1}\n".format(permission_mode, workbook_name)) 335 | 336 | ##### STEP 5: Sign out ##### 337 | print("\n5. Signing out and invalidating the authentication token") 338 | sign_out(server, auth_token) 339 | 340 | 341 | if __name__ == "__main__": 342 | main() 343 | -------------------------------------------------------------------------------- /python/user_permission_audit.py: -------------------------------------------------------------------------------- 1 | #### 2 | # This script contains functions that demonstrate how to audit 3 | # a permission for a given user on a workbook and adds or updates 4 | # the permission. 5 | # 6 | # To run the script, you must have installed Python 2.7.9 or later, 7 | # plus the 'requests' library: 8 | # http://docs.python-requests.org/en/latest/ 9 | # 10 | # The script takes in the server address and username as arguments, 11 | # where the server address has no trailing slash (e.g. http://localhost). 12 | # Run the script in terminal by entering: 13 | # python publish_sample.py 14 | # 15 | # When running the script, it will prompt for the following: 16 | # 'Username to audit': Enter username to audit permissions for 17 | # 'Permission to add/update': Enter name of permission to add or update 18 | # 'Mode to set permission': Enter either 'Allow' or 'Deny' to set the permission mode 19 | # 'Name of workbook to audit': Enter name of workbook to audit permission for 20 | # 'Password': Enter password for the user to log in as. 21 | # 22 | # Possible permission names: 23 | # Read, Write, Filter, AddComment, ViewComments, ShareView, ExportData, ViewUnderlyingData, 24 | # ExportImage, Delete, ChangeHierarchy, ChangePermissions, WebAuthoring, ExportXml 25 | # 26 | # Possible permission modes: 27 | # Allow, Deny 28 | #### 29 | 30 | from version import VERSION 31 | import requests # Contains methods used to make HTTP requests 32 | import xml.etree.ElementTree as ET # Contains methods used to build and parse XML 33 | import sys 34 | import getpass 35 | 36 | # The namespace for the REST API is 'http://tableausoftware.com/api' for Tableau Server 9.0 37 | # or 'http://tableau.com/api' for Tableau Server 9.1 or later 38 | xmlns = {'t': 'http://tableau.com/api'} 39 | 40 | # All possible permission names 41 | permissions = {"Read", "Write", "Filter", "AddComment", "ViewComments", "ShareView", "ExportData", "ViewUnderlyingData", 42 | "ExportImage", "Delete", "ChangeHierarchy", "ChangePermissions", "WebAuthoring", "ExportXml"} 43 | 44 | # Possible modes for to set the permissions 45 | modes = {"Allow", "Deny"} 46 | 47 | # If using python version 3.x, 'raw_input()' is changed to 'input()' 48 | if sys.version[0] == '3': raw_input=input 49 | 50 | 51 | class ApiCallError(Exception): 52 | pass 53 | 54 | 55 | class UserDefinedFieldError(Exception): 56 | pass 57 | 58 | 59 | def _encode_for_display(text): 60 | """ 61 | Encodes strings so they can display as ASCII in a Windows terminal window. 62 | This function also encodes strings for processing by xml.etree.ElementTree functions. 63 | 64 | Returns an ASCII-encoded version of the text. 65 | Unicode characters are converted to ASCII placeholders (for example, "?"). 66 | """ 67 | return text.encode('ascii', errors="backslashreplace").decode('utf-8') 68 | 69 | 70 | def _check_status(server_response, success_code): 71 | """ 72 | Checks the server response for possible errors. 73 | 74 | 'server_response' the response received from the server 75 | 'success_code' the expected success code for the response 76 | Throws an ApiCallError exception if the API call fails. 77 | """ 78 | if server_response.status_code != success_code: 79 | parsed_response = ET.fromstring(server_response.text) 80 | 81 | # Obtain the 3 xml tags from the response: error, summary, and detail tags 82 | error_element = parsed_response.find('t:error', namespaces=xmlns) 83 | summary_element = parsed_response.find('.//t:summary', namespaces=xmlns) 84 | detail_element = parsed_response.find('.//t:detail', namespaces=xmlns) 85 | 86 | # Retrieve the error code, summary, and detail if the response contains them 87 | code = error_element.get('code', 'unknown') if error_element is not None else 'unknown code' 88 | summary = summary_element.text if summary_element is not None else 'unknown summary' 89 | detail = detail_element.text if detail_element is not None else 'unknown detail' 90 | error_message = '{0}: {1} - {2}'.format(code, summary, detail) 91 | raise ApiCallError(error_message) 92 | return 93 | 94 | 95 | def sign_in(server, username, password, site=""): 96 | """ 97 | Signs in to the server specified with the given credentials 98 | 99 | 'server' specified server address 100 | 'username' is the name (not ID) of the user to sign in as. 101 | Note that most of the functions in this example require that the user 102 | have server administrator permissions. 103 | 'password' is the password for the user. 104 | 'site' is the ID (as a string) of the site on the server to sign in to. The 105 | default is "", which signs in to the default site. 106 | Returns the authentication token and the site ID. 107 | """ 108 | url = server + "/api/{0}/auth/signin".format(VERSION) 109 | 110 | # Builds the request 111 | xml_request = ET.Element('tsRequest') 112 | credentials_element = ET.SubElement(xml_request, 'credentials', name=username, password=password) 113 | ET.SubElement(credentials_element, 'site', contentUrl=site) 114 | xml_request = ET.tostring(xml_request) 115 | 116 | # Make the request to server 117 | server_response = requests.post(url, data=xml_request) 118 | _check_status(server_response, 200) 119 | 120 | # ASCII encode server response to enable displaying to console 121 | server_response = _encode_for_display(server_response.text) 122 | 123 | # Reads and parses the response 124 | parsed_response = ET.fromstring(server_response) 125 | 126 | # Gets the auth token and site ID 127 | token = parsed_response.find('t:credentials', namespaces=xmlns).get('token') 128 | site_id = parsed_response.find('.//t:site', namespaces=xmlns).get('id') 129 | user_id = parsed_response.find('.//t:user', namespaces=xmlns).get('id') 130 | return token, site_id, user_id 131 | 132 | 133 | def sign_out(server, auth_token): 134 | """ 135 | Destroys the active session and invalidates authentication token. 136 | 137 | 'server' specified server address 138 | 'auth_token' authentication token that grants user access to API calls 139 | """ 140 | url = server + "/api/{0}/auth/signout".format(VERSION) 141 | server_response = requests.post(url, headers={'x-tableau-auth': auth_token}) 142 | _check_status(server_response, 204) 143 | return 144 | 145 | 146 | def get_workbook_id(server, auth_token, user_id, site_id, workbook_name): 147 | """ 148 | Gets the id of the desired workbook to relocate. 149 | 150 | 'server' specified server address 151 | 'auth_token' authentication token that grants user access to API calls 152 | 'user_id' ID of user with access to workbooks 153 | 'site_id' ID of the site that the user is signed into 154 | 'workbook_name' name of workbook to get ID of 155 | Returns the workbook id and the project id that contains the workbook. 156 | """ 157 | url = server + "/api/{0}/sites/{1}/users/{2}/workbooks".format(VERSION, site_id, user_id) 158 | server_response = requests.get(url, headers={'x-tableau-auth': auth_token}) 159 | _check_status(server_response, 200) 160 | xml_response = ET.fromstring(_encode_for_display(server_response.text)) 161 | 162 | # Find all workbooks in the site and look for the desired one 163 | workbooks = xml_response.findall('.//t:workbook', namespaces=xmlns) 164 | for workbook in workbooks: 165 | if workbook.get('name') == workbook_name: 166 | return workbook.get('id') 167 | error = "Workbook named '{0}' not found.".format(workbook_name) 168 | raise LookupError(error) 169 | 170 | 171 | def get_user_id(server, auth_token, site_id, username_to_audit): 172 | """ 173 | Returns the user id of the user to audit permissions for, if found. 174 | 175 | 'server' specified server address 176 | 'auth_token' authentication token that grants user access to API calls 177 | 'site_id' ID of the site that the user is signed into 178 | 'username_to_audit' username to audit permission for on server 179 | """ 180 | url = server + "/api/{0}/sites/{1}/users".format(VERSION, site_id) 181 | server_response = requests.get(url, headers={'x-tableau-auth': auth_token}) 182 | _check_status(server_response, 200) 183 | server_response = ET.fromstring(_encode_for_display(server_response.text)) 184 | 185 | # Find all user tags in the response and look for matching id 186 | users = server_response.findall('.//t:user', namespaces=xmlns) 187 | for user in users: 188 | if user.get('name') == username_to_audit: 189 | return user.get('id') 190 | error = "User id for {0} not found".format(username_to_audit) 191 | raise LookupError(error) 192 | 193 | 194 | def query_permission(server, auth_token, site_id, workbook_id, user_id): 195 | """ 196 | Returns a list of all permissions for the specified user. 197 | 198 | 'server' specified server address 199 | 'auth_token' authentication token that grants user access to API calls 200 | 'site_id' ID of the site that the user is signed into 201 | 'workbook_id' ID of workbook to audit permission in 202 | 'user_id' ID of the user to audit 203 | """ 204 | url = server + "/api/{0}/sites/{1}/workbooks/{2}/permissions".format(VERSION, site_id, workbook_id) 205 | server_response = requests.get(url, headers={'x-tableau-auth': auth_token}) 206 | _check_status(server_response, 200) 207 | server_response = _encode_for_display(server_response.text) 208 | 209 | # Reads and parses the response 210 | parsed_response = ET.fromstring(server_response) 211 | 212 | # Find all the capabilities for a specific user 213 | capabilities = parsed_response.findall('.//t:granteeCapabilities', namespaces=xmlns) 214 | for capability in capabilities: 215 | user = capability.find('.//t:user', namespaces=xmlns) 216 | if user is not None and user.get('id') == user_id: 217 | return capability.findall('.//t:capability', namespaces=xmlns) 218 | error = "Permissions not found for this workbook" 219 | raise LookupError(error) 220 | 221 | 222 | def delete_permission(server, auth_token, site_id, workbook_id, user_id, permission_name, existing_mode): 223 | """ 224 | Deletes a specific permission from the workbook. 225 | 226 | 'server' specified server address 227 | 'auth_token' authentication token that grants user access to API calls 228 | 'site_id' ID of the site that the user is signed into 229 | 'workbook_id' ID of workbook to audit permission in 230 | 'user_id' ID of the user to audit 231 | 'permission_name' name of permission to add or update 232 | 'existing_mode' is the mode of the permission already set for the workbook 233 | """ 234 | url = server + "/api/{0}/sites/{1}/workbooks/{2}/permissions/users/{3}/{4}/{5}".format(VERSION, 235 | site_id, 236 | workbook_id, 237 | user_id, 238 | permission_name, 239 | existing_mode) 240 | server_response = requests.delete(url, headers={'x-tableau-auth': auth_token}) 241 | _check_status(server_response, 204) 242 | return 243 | 244 | 245 | def add_new_permission(server, auth_token, site_id, workbook_id, user_id, permission_name, permission_mode): 246 | """ 247 | Adds the specified permission to the workbook for the desired user. 248 | 249 | 'server' specified server address 250 | 'auth_token' authentication token that grants user access to API calls 251 | 'site_id' ID of the site that the user is signed into 252 | 'workbook_id' ID of workbook to audit permission in 253 | 'user_id' ID of the user to audit 254 | 'permission_name' name of permission to add or update 255 | 'permission_mode' mode to set the permission 256 | """ 257 | url = server + "/api/{0}/sites/{1}/workbooks/{2}/permissions".format(VERSION, site_id, workbook_id) 258 | 259 | # Build the request 260 | xml_request = ET.Element('tsRequest') 261 | permissions_element = ET.SubElement(xml_request, 'permissions') 262 | ET.SubElement(permissions_element, 'workbook', id=workbook_id) 263 | grantee_element = ET.SubElement(permissions_element, 'granteeCapabilities') 264 | ET.SubElement(grantee_element, 'user', id=user_id) 265 | capabilities_element = ET.SubElement(grantee_element, 'capabilities') 266 | ET.SubElement(capabilities_element, 'capability', name=permission_name, mode=permission_mode) 267 | xml_request = ET.tostring(xml_request) 268 | 269 | server_request = requests.put(url, data=xml_request, headers={'x-tableau-auth': auth_token}) 270 | _check_status(server_request, 200) 271 | print("\tSuccessfully added/updated permission") 272 | return 273 | 274 | 275 | def main(): 276 | ##### STEP 0: Initialization ##### 277 | if len(sys.argv) != 3: 278 | error = "2 arguments needed (server, username)" 279 | raise UserDefinedFieldError(error) 280 | server = sys.argv[1] 281 | server_username = sys.argv[2] 282 | username_to_audit = raw_input("\nUsername to audit permissions for: ") 283 | permission_name = raw_input("\nPermission to add: ") 284 | permission_mode = raw_input("\nAllow or deny permission(Allow/Deny): ") 285 | workbook_name = raw_input("\nName of workbook to audit permissions for: ") 286 | 287 | if permission_name not in permissions: 288 | error = "Not a valid permission name" 289 | raise UserDefinedFieldError(error) 290 | 291 | if permission_mode not in modes: 292 | error = "Not a valid permission mode" 293 | raise UserDefinedFieldError(error) 294 | 295 | print("\n*Auditing permissions for {0}*".format(username_to_audit)) 296 | password = getpass.getpass("Password for {0}: ".format(server_username)) 297 | 298 | ##### STEP 1: Sign in ##### 299 | print("\n1. Signing in as " + server_username) 300 | auth_token, site_id, user_id = sign_in(server, server_username, password) 301 | 302 | ##### STEP 2: Find id of username to audit ##### 303 | print("\n2. Finding user id of {0}".format(username_to_audit)) 304 | user_id = get_user_id(server, auth_token, site_id, username_to_audit) 305 | 306 | ##### STEP 3: Find workbook id ##### 307 | print("\n3. Finding workbook id of '{0}'".format(workbook_name)) 308 | workbook_id = get_workbook_id(server, auth_token, user_id, site_id, workbook_name) 309 | 310 | ##### STEP 4: Query permissions ##### 311 | print("\n4. Querying all permissions for workbook") 312 | user_permissions = query_permission(server, auth_token, site_id, workbook_id, user_id) 313 | 314 | ##### STEP 5: Check if permission already exists and delete is set to 'Deny' ##### 315 | print("\n5. Checking if permission already exists and deleting if mode differs") 316 | update_permission = True 317 | for permission in user_permissions: 318 | if permission.get('name') == permission_name: 319 | if permission.get('mode') != permission_mode: 320 | print("\tDeleting existing permission") 321 | existing_mode = permission.get('mode') 322 | delete_permission(server, auth_token, site_id, workbook_id, 323 | user_id, permission_name, existing_mode) 324 | else: 325 | update_permission = False 326 | 327 | ##### STEP 6: Add the desired permission set to 'Allow' if it doesn't already exist ##### 328 | print("\n6. Adding desired permission") 329 | if update_permission: 330 | add_new_permission(server, auth_token, site_id, workbook_id, 331 | user_id, permission_name, permission_mode) 332 | else: 333 | print("\tPermission already set to {0}".format(permission_mode)) 334 | 335 | ##### STEP 7: Sign out ##### 336 | print("\n7. Signing out and invalidating the authentication token") 337 | sign_out(server, auth_token) 338 | 339 | 340 | if __name__ == "__main__": 341 | main() -------------------------------------------------------------------------------- /python/users_by_group.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=C0301 2 | # keep long urls on one line for readabilty 3 | """ 4 | # This script prints out users by Tableau Server group by site 5 | # 6 | # To run the script, you must have installed Python 2.7.9 or later, 7 | # plus the 'requests' library: 8 | # http://docs.python-requests.org/en/latest/ 9 | # 10 | # Run the script in a terminal window by entering: 11 | # python users_by_group.py 12 | # 13 | # You will be prompted for site id, and group name 14 | # There is also an option to print out all groups 15 | # See the main() method for details 16 | # 17 | # This script requires a server administrator or a site administrator. 18 | # 19 | # The file version.py must be in the local folder with the correct API version number 20 | """ 21 | 22 | import xml.etree.ElementTree as ET # Contains methods used to build and parse XML 23 | import sys 24 | import getpass 25 | import requests # Contains methods used to make HTTP requests 26 | from version import VERSION 27 | 28 | # The namespace for the REST API is 'http://tableausoftware.com/api' for Tableau Server 9.0 29 | # or 'http://tableau.com/api' for Tableau Server 9.1 or later 30 | XMLNS = {'t': 'http://tableau.com/api'} 31 | 32 | # If using python version 3.x, 'raw_input()' is changed to 'input()' 33 | if sys.version[0] == '3': raw_input=input 34 | 35 | class ApiCallError(Exception): 36 | """ ApiCallError """ 37 | pass 38 | 39 | class UserDefinedFieldError(Exception): 40 | """ UserDefinedFieldError """ 41 | pass 42 | 43 | def _encode_for_display(text): 44 | """ 45 | Encodes strings so they can display as ASCII in a Windows terminal window. 46 | This function also encodes strings for processing by xml.etree.ElementTree functions. 47 | 48 | Returns an ASCII-encoded version of the text. 49 | Unicode characters are converted to ASCII placeholders (for example, "?"). 50 | """ 51 | return text.encode('ascii', errors="backslashreplace").decode('utf-8') 52 | 53 | def _check_status(server_response, success_code): 54 | """ 55 | Checks the server response for possible errors. 56 | 57 | 'server_response' the response received from the server 58 | 'success_code' the expected success code for the response 59 | Throws an ApiCallError exception if the API call fails. 60 | """ 61 | if server_response.status_code != success_code: 62 | parsed_response = ET.fromstring(server_response.text) 63 | 64 | # Obtain the 3 xml tags from the response: error, summary, and detail tags 65 | error_element = parsed_response.find('t:error', namespaces=XMLNS) 66 | summary_element = parsed_response.find('.//t:summary', namespaces=XMLNS) 67 | detail_element = parsed_response.find('.//t:detail', namespaces=XMLNS) 68 | 69 | # Retrieve the error code, summary, and detail if the response contains them 70 | code = error_element.get('code', 'unknown') if error_element is not None else 'unknown code' 71 | summary = summary_element.text if summary_element is not None else 'unknown summary' 72 | detail = detail_element.text if detail_element is not None else 'unknown detail' 73 | error_message = '{0}: {1} - {2}'.format(code, summary, detail) 74 | raise ApiCallError(error_message) 75 | return 76 | 77 | def sign_in(server, username, password, site): 78 | """ 79 | Signs in to the server specified with the given credentials 80 | 81 | 'server' specified server address 82 | 'username' is the name (not ID) of the user to sign in as. 83 | Note that most of the functions in this example require that the user 84 | have server administrator permissions. 85 | 'password' is the password for the user. 86 | 'site' is the ID (as a string) of the site on the server to sign in to. The 87 | default is "", which signs in to the default site. 88 | Returns the authentication token and the site ID. 89 | """ 90 | url = server + "/api/{0}/auth/signin".format(VERSION) 91 | 92 | # Builds the request 93 | xml_request = ET.Element('tsRequest') 94 | credentials_element = ET.SubElement(xml_request, 'credentials', name=username, password=password) 95 | ET.SubElement(credentials_element, 'site', contentUrl=site) 96 | xml_request = ET.tostring(xml_request) 97 | 98 | # Make the request to server 99 | server_response = requests.post(url, data=xml_request) 100 | _check_status(server_response, 200) 101 | 102 | # ASCII encode server response to enable displaying to console 103 | server_response = _encode_for_display(server_response.text) 104 | 105 | # Reads and parses the response 106 | parsed_response = ET.fromstring(server_response) 107 | 108 | # Gets the auth token and site ID 109 | token = parsed_response.find('t:credentials', namespaces=XMLNS).get('token') 110 | site_id = parsed_response.find('.//t:site', namespaces=XMLNS).get('id') 111 | # user_id = parsed_response.find('.//t:user', namespaces=XMLNS).get('id') 112 | return token, site_id 113 | 114 | def sign_out(server, auth_token): 115 | """ 116 | Destroys the active session and invalidates authentication token. 117 | 118 | 'server' specified server address 119 | 'auth_token' authentication token that grants user access to API calls 120 | """ 121 | url = server + "/api/{0}/auth/signout".format(VERSION) 122 | server_response = requests.post(url, headers={'x-tableau-auth': auth_token}) 123 | _check_status(server_response, 204) 124 | return 125 | 126 | def get_group_id(server, auth_token, site_id, group_name): 127 | """ 128 | Returns the group id for the group name 129 | """ 130 | url = server + "/api/{0}/sites/{1}/groups".format(VERSION, site_id) 131 | server_response = requests.get(url, headers={'x-tableau-auth': auth_token}) 132 | _check_status(server_response, 200) 133 | xml_response = ET.fromstring(_encode_for_display(server_response.text)) 134 | 135 | groups = xml_response.findall('.//t:group', namespaces=XMLNS) 136 | for group in groups: 137 | if group.get('name') == group_name: 138 | return group.get('id') 139 | error = "Group named '{0}' not found.".format(group_name) 140 | raise LookupError(error) 141 | 142 | 143 | def query_groups(server, auth_token, site_id, page_size, page_number): 144 | """ 145 | Queries for all groups in the site 146 | URI GET /api/api-version/sites/site-id/groups 147 | GET /api/api-version/sites/site-id/groups?pageSize=page-size&pageNumber=page-number 148 | """ 149 | if page_size == 0: 150 | url = server + "/api/{0}/sites/{1}/groups".format(VERSION, site_id) 151 | else: 152 | url = server + "/api/{0}/sites/{1}/groups?pageSize={2}&pageNumber={3}".format(VERSION, site_id, page_size, page_number) 153 | 154 | server_response = requests.get(url, headers={'x-tableau-auth': auth_token}) 155 | _check_status(server_response, 200) 156 | xml_response = ET.fromstring(_encode_for_display(server_response.text)) 157 | groups = xml_response.findall('.//t:group', namespaces=XMLNS) 158 | return groups 159 | 160 | def get_users_in_group(server, auth_token, site_id, group_id, page_size, page_number): 161 | """ 162 | Get all the users in the group using group id 163 | GET /api/api-version/sites/site-id/groups/group-id/users 164 | GET /api/api-version/sites/site-id/groups/group-id/users?pageSize=page-size&pageNumber=page-number 165 | """ 166 | if page_size == 0: 167 | url = server + "/api/{0}/sites/{1}/groups/{2}/users".format(VERSION, site_id, group_id) 168 | else: 169 | url = server + "/api/{0}/sites/{1}/groups/{2}/users?pageSize={3}&pageNumber={4}".format(VERSION, site_id, group_id, page_size, page_number) 170 | 171 | server_response = requests.get(url, headers={'x-tableau-auth': auth_token}) 172 | #_check_status(server_response, 200) 173 | xml_response = ET.fromstring(_encode_for_display(server_response.text)) 174 | users = xml_response.findall('.//t:user', namespaces=XMLNS) 175 | return users 176 | 177 | def get_users_in_group_count(server, auth_token, site_id, group_id): 178 | """ 179 | Find out how many users are available in the group 180 | GET /api/api-version/sites/site-id/groups/group-id/users 181 | """ 182 | url = server + "/api/{0}/sites/{1}/groups/{2}/users".format(VERSION, site_id, group_id) 183 | 184 | server_response = requests.get(url, headers={'x-tableau-auth': auth_token}) 185 | #_check_status(server_response, 200) 186 | xml_response = ET.fromstring(_encode_for_display(server_response.text)) 187 | total_available = xml_response.find('.//t:pagination', namespaces=XMLNS).attrib['totalAvailable'] 188 | # Note! Need to convert "total_available" to integer 189 | total_available = int(total_available) 190 | return total_available 191 | 192 | def main(): 193 | """ 194 | To automate this script then fill in the values for server, username, etc 195 | You will be prompted for any values set to "" 196 | 197 | Server and username can be entered on the command line as well. 198 | 199 | users_by_group.py http://localhost username 200 | 201 | """ 202 | # To automate the script fill in these fields 203 | server = "" 204 | username = "" 205 | password = "" 206 | site_id = "" 207 | group_name = "" 208 | page_size = 100 209 | 210 | if len(sys.argv) > 1: 211 | server = sys.argv[1] 212 | username = sys.argv[2] 213 | 214 | # Prompt for a server - include the http:// 215 | if server == "": 216 | server = raw_input("\nServer : ") 217 | 218 | # Prompt for a username 219 | if username == "": 220 | username = raw_input("\nUser name: ") 221 | 222 | # Prompt for password 223 | if password == "": 224 | password = getpass.getpass("Password: ") 225 | 226 | # Prompt for site id 227 | if site_id == "": 228 | site_id = raw_input("\nSite name (hit Return for the default site): ") 229 | 230 | # Prompt for group name 231 | if group_name == "": 232 | group_name = raw_input("\nGroup name (hit Return for all groups): ") 233 | 234 | # Prompt for page size 235 | if page_size == "": 236 | page_size = int(raw_input("\nPage size: ")) 237 | 238 | # Fix up the site id and group name - blank indicates default value 239 | if site_id == "Default": 240 | site_id = "" 241 | 242 | if group_name == "All": 243 | group_name = "" 244 | 245 | print("\nSigning in to obtain authentication token") 246 | auth_token, site_id = sign_in(server, username, password, site_id) 247 | 248 | total_available = 0 249 | total_returned = 0 250 | 251 | # get all the groups in the site 252 | groups = query_groups(server, auth_token, site_id, 0, 0) 253 | 254 | for group in groups: 255 | done = False 256 | 257 | # This method counts from 1 258 | counter = 1 259 | 260 | group_id = group.get('id') 261 | total_available = get_users_in_group_count(server, auth_token, site_id, group_id) 262 | 263 | if group_name != "" and group.get('name') != group_name: 264 | continue 265 | 266 | print("\nPrinting " + str(total_available) + ' users from the group: ' + group.get('name')) 267 | while not done: 268 | users = get_users_in_group(server, auth_token, site_id, group_id, page_size, counter) 269 | counter += 1 270 | for user in users: 271 | print(user.get('name')) 272 | 273 | total_returned = total_returned + page_size 274 | if total_returned >= total_available: 275 | done = True 276 | 277 | print("\nSigning out and invalidating the authentication token") 278 | sign_out(server, auth_token) 279 | 280 | if __name__ == "__main__": 281 | main() 282 | -------------------------------------------------------------------------------- /python/version.py: -------------------------------------------------------------------------------- 1 | VERSION = '3.26' 2 | -------------------------------------------------------------------------------- /python/webhooks.py: -------------------------------------------------------------------------------- 1 | #### 2 | # This script contains functions that move a specified workbook from 3 | # the server's 'Default' site to a specified site's 'default' project. 4 | # It moves the workbook by using an in-memory download method. 5 | # 6 | # To run the script, you must have installed Python 2.7.9 or later, 7 | # plus the 'requests' library: 8 | # http://docs.python-requests.org/en/latest/ 9 | # 10 | # The script takes in the server address and username as arguments, 11 | # where the server address has no trailing slash (e.g. http://localhost). 12 | # Run the script in terminal by entering: 13 | # python publish_sample.py 14 | # 15 | # When running the script, it will prompt for the following: 16 | # 'Name of workbook to move': Enter name of workbook to move 17 | # 'Destination site': Enter name of site to move workbook into 18 | # 'Password': Enter password for the user to log in as. 19 | #### 20 | 21 | from version import VERSION 22 | import requests # Contains methods used to make HTTP requests 23 | import xml.etree.ElementTree as ET # Contains methods used to build and parse XML 24 | 25 | import sys 26 | import getpass 27 | 28 | from credentials import SERVER, USERNAME, PASSWORD, SITENAME 29 | 30 | # The namespace for the REST API is 'http://tableausoftware.com/api' for Tableau Server 9.0 31 | # or 'http://tableau.com/api' for Tableau Server 9.1 or later 32 | xmlns = {'t': 'http://tableau.com/api'} 33 | 34 | # If using python version 3.x, 'raw_input()' is changed to 'input()' 35 | if sys.version[0] == '3': raw_input=input 36 | 37 | 38 | class ApiCallError(Exception): 39 | pass 40 | 41 | 42 | class UserDefinedFieldError(Exception): 43 | pass 44 | 45 | 46 | def _encode_for_display(text): 47 | """ 48 | Encodes strings so they can display as ASCII in a Windows terminal window. 49 | This function also encodes strings for processing by xml.etree.ElementTree functions. 50 | 51 | Returns an ASCII-encoded version of the text. 52 | Unicode characters are converted to ASCII placeholders (for example, "?"). 53 | """ 54 | return text.encode('ascii', errors="backslashreplace").decode('utf-8') 55 | 56 | 57 | def _check_status(server_response, success_code): 58 | """ 59 | Checks the server response for possible errors. 60 | 61 | 'server_response' the response received from the server 62 | 'success_code' the expected success code for the response 63 | Throws an ApiCallError exception if the API call fails. 64 | """ 65 | if server_response.status_code != success_code: 66 | parsed_response = ET.fromstring(server_response.text) 67 | 68 | # Obtain the 3 xml tags from the response: error, summary, and detail tags 69 | error_element = parsed_response.find('t:error', namespaces=xmlns) 70 | summary_element = parsed_response.find('.//t:summary', namespaces=xmlns) 71 | detail_element = parsed_response.find('.//t:detail', namespaces=xmlns) 72 | 73 | # Retrieve the error code, summary, and detail if the response contains them 74 | code = error_element.get('code', 'unknown') if error_element is not None else 'unknown code' 75 | summary = summary_element.text if summary_element is not None else 'unknown summary' 76 | detail = detail_element.text if detail_element is not None else 'unknown detail' 77 | error_message = '{0}: {1} - {2}'.format(code, summary, detail) 78 | raise ApiCallError(error_message) 79 | return 80 | 81 | 82 | def sign_in(server, username, password, site=""): 83 | """ 84 | Signs in to the server specified with the given credentials 85 | 86 | 'server' specified server address 87 | 'username' is the name (not ID) of the user to sign in as. 88 | Note that most of the functions in this example require that the user 89 | have server administrator permissions. 90 | 'password' is the password for the user. 91 | 'site' is the ID (as a string) of the site on the server to sign in to. The 92 | default is "", which signs in to the default site. 93 | Returns the authentication token and the site ID. 94 | """ 95 | url = server + "/api/{0}/auth/signin".format(VERSION) 96 | 97 | # Builds the request 98 | xml_request = ET.Element('tsRequest') 99 | credentials_element = ET.SubElement(xml_request, 'credentials', name=username, password=password) 100 | ET.SubElement(credentials_element, 'site', contentUrl=site) 101 | xml_request = ET.tostring(xml_request) 102 | 103 | # Make the request to server 104 | server_response = requests.post(url, data=xml_request) 105 | _check_status(server_response, 200) 106 | 107 | # ASCII encode server response to enable displaying to console 108 | server_response = _encode_for_display(server_response.text) 109 | 110 | # Reads and parses the response 111 | parsed_response = ET.fromstring(server_response) 112 | 113 | # Gets the auth token and site ID 114 | token = parsed_response.find('t:credentials', namespaces=xmlns).get('token') 115 | site_id = parsed_response.find('.//t:site', namespaces=xmlns).get('id') 116 | user_id = parsed_response.find('.//t:user', namespaces=xmlns).get('id') 117 | return token, site_id, user_id 118 | 119 | 120 | def sign_out(server, auth_token): 121 | """ 122 | Destroys the active session and invalidates authentication token. 123 | 124 | 'server' specified server address 125 | 'auth_token' authentication token that grants user access to API calls 126 | """ 127 | url = server + "/api/{0}/auth/signout".format(VERSION) 128 | server_response = requests.post(url, headers={'x-tableau-auth': auth_token}) 129 | _check_status(server_response, 204) 130 | return 131 | 132 | 133 | 134 | # webhook specific methods 135 | 136 | def list_all_webhooks(server, site, auth_token): 137 | 138 | url = server + "/api/{0}/sites/{1}/webhooks".format(VERSION, site) 139 | print(url) 140 | server_response = requests.get(url, headers={'x-tableau-auth': auth_token}) 141 | 142 | _check_status(server_response, 200) 143 | # Gets the auth token and webhook ID 144 | xml_response = ET.fromstring(_encode_for_display(server_response.text)) 145 | print('-----') 146 | print(_encode_for_display(server_response.text)) 147 | print('-----') 148 | return xml_response.find(".//t:webhooks", namespaces=xmlns) 149 | 150 | 151 | 152 | def get_webhook_by_id(server, site, auth_token, webhook_id): 153 | 154 | url = server + "/api/{0}/sites/{1}/webhooks/{2}".format(VERSION, site, webhook_id) 155 | print(url) 156 | 157 | # Build the request to get a webhook 158 | xml_request = ET.Element('tsRequest') 159 | xml_request = ET.tostring(xml_request) 160 | print(xml_request) 161 | 162 | server_response = requests.get(url, data=xml_request, headers={'x-tableau-auth': auth_token}) 163 | _check_status(server_response, 200) 164 | 165 | # Returns a webhook element 166 | xml_response = ET.fromstring(_encode_for_display(server_response.text)) 167 | print('-----') 168 | print(_encode_for_display(server_response.text)) 169 | return xml_response.find(".//t:webhook", namespaces=xmlns) 170 | 171 | 172 | 173 | 174 | def test_webhook(server, site, auth_token, webhook_id): 175 | url = server + "/api/{0}/sites/{1}/webhooks/{2}/test".format(VERSION, site, webhook_id) 176 | print(url) 177 | server_response = requests.get(url, headers={'x-tableau-auth': auth_token}) 178 | 179 | # Gets the auth token and webhook ID 180 | xml_response = ET.fromstring(_encode_for_display(server_response.text)) 181 | print('-----') 182 | print(_encode_for_display(server_response.text)) 183 | #print('-----') 184 | return xml_response.find(".//t:webhookTestResult", namespaces=xmlns) 185 | 186 | 187 | 188 | def create_webhook(server, site, auth_token, source_event, webhook_endpoint, webhook_name): 189 | 190 | url = server + "/api/{0}/sites/{1}/webhooks".format(VERSION, site) 191 | print(url) 192 | 193 | # Build the request to create webhook 194 | xml_request = ET.Element('tsRequest') 195 | webhook_element = ET.SubElement(xml_request, 'webhook', name=webhook_name) 196 | 197 | source_element = ET.SubElement(webhook_element, 'webhook-source') 198 | ET.SubElement(source_element, source_event) 199 | 200 | destination_element = ET.SubElement(webhook_element, 'webhook-destination') 201 | http_element = ET.SubElement(destination_element, 'webhook-destination-http', method='POST', url=webhook_endpoint) 202 | 203 | xml_request = ET.tostring(xml_request) 204 | print (xml_request) 205 | 206 | server_response = requests.post(url, data=xml_request, headers={'x-tableau-auth': auth_token}) 207 | 208 | _check_status(server_response, 201) 209 | # Gets the auth token and webhook ID 210 | xml_response = ET.fromstring(_encode_for_display(server_response.text)) 211 | print ('-----') 212 | print( _encode_for_display(server_response.text)) 213 | return xml_response.find(".//t:webhook", namespaces=xmlns) 214 | 215 | 216 | def delete_webhook(server, site_id, auth_token, webhook_id): 217 | url = server + "/api/{0}/sites/{1}/webhooks/{2}".format(VERSION, site_id, webhook_id) 218 | print("deleting webhook {0} - {1}".format(webhook_id, url)) 219 | 220 | server_response = requests.delete(url, headers={'x-tableau-auth': auth_token}) 221 | print (server_response) 222 | return 223 | 224 | 225 | # webhook event sources 226 | 227 | datasource_refresh_events = [ 228 | 'webhook-source-event-datasource-refresh-started', 229 | 'webhook-source-event-datasource-refresh-succeeded', 230 | 'webhook-source-event-datasource-refresh-failed' 231 | ] 232 | 233 | workbook_events = [ 234 | 'webhook-source-event-workbook-created', 235 | 'webhook-source-event-workbook-updated', 236 | 'webhook-source-event-workbook-deleted', 237 | ] 238 | datasource_events = [ 239 | 'webhook-source-event-datasource-created', 240 | 'webhook-source-event-datasource-updated', 241 | 'webhook-source-event-datasource-deleted', 242 | ] 243 | 244 | 245 | 246 | 247 | def delete_all(): 248 | 249 | webhook = list_all_webhooks(server, site_id, auth_token) 250 | print ("webhooks:") 251 | for item in webhook: 252 | print(item) 253 | webhook_id = item.get('id') 254 | site = delete_webhook(server, site_id, auth_token, webhook_id) 255 | print("\n3. Deleting webhook {0}".format(webhook_id)) 256 | 257 | 258 | print("\nSigning out and invalidating the authentication token") 259 | sign_out(server, auth_token) 260 | 261 | 262 | 263 | 264 | def main(): 265 | 266 | server = SERVER 267 | username = USERNAME 268 | password = PASSWORD 269 | site_name = SITENAME 270 | 271 | if (site_name == "Default"): 272 | site_name = "" 273 | 274 | ##### STEP 1: Signing in to obtain authentication token 275 | auth_token, site_id, user_id = sign_in(server, username, password, site_name) 276 | print("Signed in to site ", site_id) 277 | 278 | ##### STEP 2. create a new webhook 279 | webhook_endpoint = 'https://webhook.site/ef2be372-63ae-4f6b-8613-dccec992117f' 280 | event = workbook_events[0] # can use any of those defined above 281 | webhook_name = event + "-webhook-site-automated-test" 282 | created_webhook = create_webhook(server, site_id, auth_token, event, webhook_endpoint, webhook_name) 283 | webhook_id = created_webhook.get("id") 284 | print("\n2. Created a webhook {0} with id {1}".format(webhook_name, webhook_id)) 285 | 286 | 287 | ##### STEP 3: Find webhook id of newly created item by its id, just for fun 288 | print("\n3. Finding webhook with id '{0}'".format(webhook_id)) 289 | webhook = get_webhook_by_id(server, site_id, auth_token, webhook_id) 290 | print("\n found webhook with name {0}".format(webhook.get('name'))) 291 | 292 | 293 | ##### STEP 4: Test the new webhook 294 | test_webhook(server, site_id, auth_token, webhook_id) 295 | 296 | 297 | ##### STEP 5: delete the webhook 298 | site = delete_webhook(server, site_id, auth_token, webhook_id) 299 | print("\n3. Deleting new webhook") 300 | 301 | 302 | print("\nSigning out and invalidating the authentication token") 303 | sign_out(server, auth_token) 304 | 305 | if __name__ == "__main__": 306 | main() 307 | --------------------------------------------------------------------------------