` in your HTML to contain the embedded view:
```html
```
### JavaScript Initialization
Import the necessary objects from the Embedding API library and create a new `TableauAuthoringViz` instance. Remember to append the viz to the DOM to render it.
```javascript
import {
TableauAuthoringViz,
TableauEventType,
} from 'https://my-server/javascripts/api/tableau.embedding.3.latest.min.js';
const viz = new TableauAuthoringViz();
viz.src = 'https://my-server/authoring/my-workbook/my-view';
viz.hideCloseButton = true;
viz.addEventListener(TableauEventType.WorkbookPublished, handlePublished);
document.getElementById('tableauAuthoringViz').appendChild(viz);
// Ensure you have a handlePublished function defined to handle the event
function handlePublished() {
console.log('Workbook published!');
}
```
### Importing JavaScript Files
If your JavaScript code is in a separate file, ensure it's imported with `type="module"`:
```html
```
```
--------------------------------
### Get Underlying Data from a DataSource
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/DataSource.html
Retrieves all rows and columns from the underlying data of a specific data source. This example demonstrates how to find a data source by name and then extract unique values for a given field.
```javascript
const dataSources = await worksheet.getDataSourcesAsync();
const dataSource = dataSources.find(datasource => datasource.name === "Sample - Superstore");
const dataTable = await dataSource.getUnderlyingDataAsync();
let field = dataTable.columns.find(column => column.fieldName === "Sub-Category");
let list = [];
for (let row of dataTable.data) {
list.push(row[field.index].value);
}
let values = list.filter((el, i, arr) => arr.indexOf(el) === i);
console.log(values);
```
--------------------------------
### Simplified Configuration with Web Component Attributes
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_migration_guide.html
Configure viz initialization options directly as properties of the
web component using HTML attributes, simplifying the process compared to v2's options object.
```html
```
--------------------------------
### Declarative Event Handling with Web Components
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_event.html
Starting from Embedding API v3.3, you can declaratively handle events by specifying the event type attribute directly in the web component. This example shows how to handle the `onMarkSelectionChanged` event for a `` component.
```APIDOC
## Declarative Event Handling
### Description
Handle events directly within the web component using attributes.
### Example
```html
```
### Note
The `handleMarksSelection` function must be defined in your JavaScript code.
```
--------------------------------
### Initialize Tableau Web Authoring View with JavaScript
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_web_authoring.html
Initialize a web authoring view using the `TableauAuthoringViz` object. Import the necessary components, create an instance, configure properties like `src` and `hideCloseButton`, add event listeners, and append it to the DOM.
```javascript
import {
TableauAuthoringViz,
TableauEventType,
} from 'https://my-server/javascripts/api/tableau.embedding.3.latest.min.js';
const viz = new TableauAuthoringViz();
viz.src = 'https://my-server/authoring/my-workbook/my-view';
viz.hideCloseButton = true;
viz.addEventListener(TableauEventType.WorkbookPublished, handlePublished);
document.getElementById('tableauViz').appendChild(viz);
```
--------------------------------
### Initialize v2 API (JavaScript)
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_migration_guide.html
v2 initialization involved creating a new tableau.Viz object, referencing the placeholder div and the viz URL.
```javascript
let placeholderDiv = document.getElementById("tableauViz");
let src = "http://my-server/views/my-workbook/my-view";
let options = {}
let viz = new tableau.Viz(placeholderDiv, url, options);
```
--------------------------------
### Set parameters during initialization using JavaScript
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_parameters.html
Demonstrates how to set parameters when initializing an embedded Tableau view using JavaScript by creating and appending `viz-parameter` elements.
```APIDOC
## Set parameters during initialization using JavaScript
### Description
If you are using JavaScript to initialize your embedding view, you can add parameters by creating a `viz-parameter` child node. You add the `vizParameter` node to the `viz` object before adding the `viz` object to the HTML page.
The following example shows the syntax you would use to create a parameter element that you can add to the `viz` object.
### Code Example
```javascript
const vizParameter = document.createElement("viz-parameter");
vizParameter.setAttribute("name", "parameter-name");
vizParameter.setAttribute("value", "parameter-value");
viz.appendChild(vizParameter);
```
The following example sets the Base Salary parameter to 75,000. To do this, you create the `vizParameter` element and then add attributes for `name` and a `value`, in this case, `Base Salary` and `75000` respectively. You then can append the `vizParameter` to the `viz`. You should add the `viz-parameter` child node before setting the `viz.src` URL.
### Code Example
```javascript
import {
TableauViz,
TableauEventType
} from "https://public.tableau.com/javascripts/api/tableau.embedding.3.latest.js";
const viz = new TableauViz();
const vizParameter = document.createElement("viz-parameter");
vizParameter.setAttribute("name", "Base Salary");
vizParameter.setAttribute("value", "75000");
viz.appendChild(vizParameter);
viz.src = "https://public.tableau.com/views/Superstore_800_600/CommissionModel";
viz.toolbar = "hidden";
document.getElementById("tableauViz").appendChild(viz);
```
```
--------------------------------
### Initialize Tableau Viz with Event Listener
Source: https://help.tableau.com/current/api/embedding_api/en-us/tutorial/tutorial.htm
Creates a Tableau visualization instance, sets its dimensions and display options, and configures an event listener for when the viz becomes interactive. The workbook and active sheet are cached upon interaction.
```javascript
function initializeViz() {
viz = document.getElementById("viz");
viz.width = 1200;
viz.height = 800;
viz.hideTabs = true;
viz.hideToolbar = true;
const onFirstInteractive = () => {
workbook = viz.getWorkbook();
activeSheet = workbook.getActiveSheet();
};
viz.addEventListener(TableauEventType.FirstInteractive, onFirstInteractive);
viz.src = "https://public.tableau.com/views/WorldIndicators_17297174004850/GDPpercapita";
}
```
--------------------------------
### launchAnalyticsAssistantAsync
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/VizActions.html
Asynchronously launches the Analytics Assistant for the current visualization.
```APIDOC
## launchAnalyticsAssistantAsync
### Description
Asynchronously launches the Analytics Assistant for the current visualization.
### Method
launchAnalyticsAssistantAsync
### Returns
Promise
```
--------------------------------
### launchAnalyticsAssistantAsync
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/VizActions.html
Launches the Analytics Assistant side pane. It's recommended to check availability using `isAnalyticsAssistantAvailableAsync()` before calling this method.
```APIDOC
## launchAnalyticsAssistantAsync
### Description
Use this method to launch the Analytics Assistant side pane. You can use the `isAnalyticsAssistantAvailableAsync()` method to check if the Analytics Assistant is available for use.
### Method Signature
`launchAnalyticsAssistantAsync(): Promise`
### Returns
- Type: `Promise`
### Example
```javascript
const isAnalyticsAssistantAvailable = await viz.isAnalyticsAssistantAvailableAsync();
if (isAnalyticsAssistantAvailable) {
await viz.launchAnalyticsAssistantAsync();
}
```
```
--------------------------------
### Syntax for Creating Custom Parameters in JavaScript
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_parameters.html
Demonstrates how to programmatically create a custom parameter element in JavaScript before initializing the viz. The 'name' and 'value' attributes are set using setAttribute.
```javascript
const customParameter = document.createElement("custom-parameter");
customParameter.setAttribute("name", "parameter-name");
customParameter.setAttribute("value", "parameter-value");
viz.appendChild(customParameter);
```
--------------------------------
### Apply Filters During Initialization with Web Components
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_filter.html
Use `` elements within the `` component to apply filters when the visualization loads. This method is only supported for `` components, not ``.
```html
```
```html
```
--------------------------------
### Install Specific Version of Tableau React Package
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_react.html
To install a specific version of the Tableau Embedding API React library, append the desired version number to the installation command. Always verify compatibility with your Tableau host version.
```bash
npm i @tableau/embedding-api-react@3.12.1
```
--------------------------------
### Clone an existing visualization instance
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/VizSettings.html
Use the `instance-id-to-clone` attribute to create a copy of an existing visualization. If the specified ID does not exist, the clone is based on the default visualization.
```html
```
--------------------------------
### Get Filters on Worksheet
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/Worksheet.html
Gets the list of filters applied to a worksheet. Hierarchical filters are not currently supported. Ensure this is called within an async function.
```javascript
let filters = await worksheet.getFiltersAsync();
```
--------------------------------
### Initialize Tableau Viz with Filters and Parameters (Embedding API v3)
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_migration_guide.html
Use ``, ``, and `` elements as children of `` to configure initial filtering and parameters. This replaces URL parameters used in older versions.
```html
```
--------------------------------
### Toolbar Options
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/modules.html
Options for configuring the toolbar.
```APIDOC
## Toolbar
### Description
Represents options for configuring the toolbar.
### Type
Object
```
--------------------------------
### Get Time Dimension from Pulse Metric - JavaScript
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/PulseActions.html
Gets the current time dimension applied to the Pulse metric. This method returns a Promise that resolves with the PulseTimeDimension object.
```javascript
pulse.getTimeDimensionAsync();
```
--------------------------------
### Apply Custom Parameters using JavaScript
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_parameters.html
Example of initializing a Tableau viz with JavaScript and adding a custom parameter to hide the Share button. Custom parameters must be added before the 'src' URL is assigned, and names require a colon prefix.
```javascript
import {
TableauViz
} from "https://public.tableau.com/javascripts/api/tableau.embedding.3.latest.js";
// create viz object
const viz = new TableauViz();
// add custom parameter
const customParameter = document.createElement("custom-parameter");
customParameter.setAttribute("name", ":showShareOptions");
customParameter.setAttribute("value", "false");
viz.appendChild(customParameter);
// set src URL
viz.src="https://public.tableau.com/views/Superstore_800_600/Overview";
// add viz to HTML page
document.getElementById("tableauViz").appendChild(viz);
```
--------------------------------
### Get Filters from Pulse Metric - JavaScript
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/PulseActions.html
Gets a list of filters currently applied to the Pulse metric. This method returns a Promise that resolves with an array of PulseFilter objects.
```javascript
pulse.getFiltersAsync();
```
--------------------------------
### Declarative Event Handling for Web Authoring
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_event.html
This example demonstrates how to declaratively handle events for a web authoring component using the `` web component, specifically for the `onWorkbookPublished` event.
```APIDOC
## Declarative Event Handling for Authoring
### Description
Handle authoring-specific events directly within the web component.
### Example
```html
```
### Note
The `handleWorkbookPublish` function must be defined in your JavaScript code.
```
--------------------------------
### Retrieve Selected Data from Logical Table
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_data.html
This example demonstrates how to use `getLogicalTableDataReaderAsync` and `getAllPagesAsync` to retrieve up to 150,000 rows of native data from a specific logical table. It also shows how to release resources after data retrieval.
```APIDOC
## getLogicalTableDataReaderAsync and getAllPagesAsync
### Description
Retrieves selected data from a logical table within a data source. This method prepares rows to be read as pages and allows for specifying options like requesting only native data values for performance.
### Method Signature
`getLogicalTableDataReaderAsync(logicalTableId: string, maxRowsPerPage: number, options?: GetUnderlyingDataOptions): Promise`
`getAllPagesAsync(maxRows: number): Promise`
`releaseAsync(): Promise`
### Parameters
#### `getLogicalTableDataReaderAsync` Parameters
- **logicalTableId** (string) - Required - The ID of the logical table to read data from.
- **maxRowsPerPage** (number) - Required - The maximum number of rows to prepare per page.
- **options** (GetUnderlyingDataOptions) - Optional - Options to configure data retrieval, such as `includeDataValuesOption`.
- **includeDataValuesOption** (tableau.IncludeDataValuesOption) - Optional - Specifies the type of data values to include. Use `tableau.IncludeDataValuesOption.OnlyNativeValues` for improved performance when the data source has many columns.
#### `getAllPagesAsync` Parameters
- **maxRows** (number) - Required - The maximum number of rows to retrieve across all pages.
#### `releaseAsync` Parameters
None
### Request Example
```javascript
const dataSources = await worksheet.getDataSourcesAsync();
const dataSource = dataSources.find(datasource => datasource.name === "Sample - Superstore");
const logicalTables = await dataSource.getLogicalTablesAsync()
const dataTableReader = await dataSource.getLogicalTableDataReaderAsync(logicalTables[0].id, 10000,
{ includeDataValuesOption: tableau.IncludeDataValuesOption.OnlyNativeValues });
const dataTable = await dataTableReader.getAllPagesAsync(150000);
console.log(dataTable);
// release resources
await dataTableReader.releaseAsync();
```
### Response
#### `getLogicalTableDataReaderAsync` Success Response
- **DataTableReader** - An object that allows reading data in pages.
#### `getAllPagesAsync` Success Response
- **DataTable** - An object containing the retrieved data.
#### `releaseAsync` Success Response
- **void** - Indicates that resources have been successfully released.
```
--------------------------------
### Get Summary Data (Deprecated)
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/Worksheet.html
Gets the summary data table for a worksheet. This method is deprecated and may fail with worksheets containing many rows. Use getSummaryDataReaderAsync instead. Ensure this is called within an async function.
```javascript
let vizActiveSheet = viz.workbook.activeSheet;
if (vizActiveSheet.sheetType === "worksheet") {
const dataTableReader = await vizActiveSheet.getSummaryDataReaderAsync();
const dataTable = await dataTableReader.getAllPagesAsync();
await dataTableReader.releaseAsync();
// ... process data table ...
}
```
--------------------------------
### VizAuthoringSettings Object
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/modules.html
Settings for Viz authoring.
```APIDOC
## VizAuthoringSettings
### Description
Settings related to Viz authoring.
### Type
Object
```
--------------------------------
### getFiltersAsync
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/PulseActions.html
Gets a list of filters for the Pulse metric.
```APIDOC
## getFiltersAsync
### Description
Gets a list of filters for the Pulse metric.
### Method
getFiltersAsync
### Returns
Promise - The list of filters.
```
--------------------------------
### id
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/DataSource.html
Gets the unique string identifier for this data source.
```APIDOC
## id
### Description
Unique string representing this data source.
### Property
`id: string`
```
--------------------------------
### Initialize and Embed Tableau View with JavaScript
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_basic.html
Instantiate `TableauViz`, configure its properties (like `src` and `toolbar`), add event listeners, and append it to a DOM element. Note that instantiation alone does not render the view; it must be added to the DOM.
```javascript
import {
TableauViz,
TableauEventType,
} from 'https://my-server/javascripts/api/tableau.embedding.3.latest.min.js';
const viz = new TableauViz();
viz.src = 'https://my-server/views/my-workbook/my-view';
viz.toolbar = 'hidden';
viz.addEventListener(TableauEventType.MarkSelectionChanged, handleMarkSelection);
document.getElementById('tableauViz').appendChild(viz);
/* Methods */
function handleMarkSelection() {
alert('Mark(s) selected!');
// code to handle the mark selection goes here
}
```
--------------------------------
### fields
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/DataSource.html
Gets an array of fields associated with this data source.
```APIDOC
## fields
### Description
An array of fields associated with this data source.
### Property
`fields: Field[]`
```
--------------------------------
### onFirstVizSizeKnown
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/Viz.html
Callback function executed when the size of the viz is known. Useful for resizing surrounding elements.
```APIDOC
## onFirstVizSizeKnown
### Description
An event raised when the size of the viz is known. You can use this event to perform tasks such as resizing the elements surrounding the Viz object once the object's size has been established.
### Method
Not Applicable (Event Handler Attribute)
### Endpoint
Not Applicable (Event Handler Attribute)
### Parameters
#### Attribute
- **onFirstVizSizeKnown** (string) - Optional - The name of the JavaScript function to call when the event is raised.
### Request Example
```html
```
```
--------------------------------
### Embed Empty Workbook with Dynamic GUID
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_new_workbook.html
This JavaScript code demonstrates how to create and embed a new, empty Tableau workbook. It dynamically generates a unique GUID for the workbook URL and appends it to the `src` attribute of the `tableau-authoring-viz` web component. Replace `YOUR-SITE` with your actual site name.
```javascript
Simple Empty Workbook
This is an empty workbook
```
--------------------------------
### Export Image Async
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/VizActions.html
Exports the current visualization as a PNG image. This is equivalent to clicking Download > Image from the toolbar.
```javascript
let viz = document.getElementById('tableauViz');
await viz.exportImageAsync();
```
--------------------------------
### getTimeDimensionAsync
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/PulseActions.html
Gets the current time dimension applied to the Pulse metric.
```APIDOC
## getTimeDimensionAsync
### Description
Gets the current time dimension applied to the Pulse metric.
### Method
getTimeDimensionAsync
### Returns
Promise - The current time dimension.
```
--------------------------------
### jQuery Ready Handler for Initialization
Source: https://help.tableau.com/current/api/embedding_api/en-us/tutorial/tutorial.htm
A common pattern using jQuery to ensure that the viz initialization function is called only after the DOM is fully loaded and ready.
```javascript
$(initializeViz);
```
--------------------------------
### VizSettings Object
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/modules.html
Settings for a Viz object.
```APIDOC
## VizSettings
### Description
Settings related to a Viz object.
### Type
Object
```
--------------------------------
### name
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/DataSource.html
Gets the user-friendly name of the data source as displayed in the UI.
```APIDOC
## name
### Description
The user friendly name of the data source as seen in the UI.
### Property
`name: string`
```
--------------------------------
### Extracting Filter Domains
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_pulse_filter.html
This example demonstrates how to retrieve all filters and then extract field values from the domains of categorical filters using `getFiltersAsync` and `getDomainAsync`. It includes examples for retrieving all domain values, relevant domain values, and field values containing specific strings, utilizing pagination for large datasets.
```APIDOC
## Example using `getFiltersAsync` and `getDomainAsync`
The following code example shows how you might extract the field values from the domains of two categorical filters.
The code shows an event handler for a ‘`getFilters`’ button click event.
It performs the following steps:
1. Retrieves all filters using `tableauPulse.getFiltersAsync()`.
2. For the first filter, uses `filters[0].getDomainAsync()` and:
* Retrieves all the available field values and logs the results.
* Retrieves only the relevant field values and logs the results.
3. For the second filter, uses `filters[1].getDomainAsync()` and:
* Retrieves only the relevant domain values and logs the results.
* Retrieves only the relevant field values that include the string ‘`foo`’ and logs the results.
The event handler uses pagination to retrieve all domain values in chunks (pages) until all values are retrieved. The initial page size is 100 and the page size adjusted based upon the total values available.
```javascript
// assumes a Pulse object has been created
// assumes there is a 'button' with the id 'getFilters'
getFilters.onclick = async () => {
const filters = await tableauPulse.getFiltersAsync();
console.log('filters', filters);
let domain = [];
let page = undefined;
let pageSize = 100;
do {
page = await filters[0].getDomainAsync('', pageSize, page?.nextPageToken, FilterDomainType.Database);
domain = domain.concat(page.values);
console.log(`Retrieved ${domain.length} of ${page.totalAvailable} field values`);
pageSize = page.totalAvailable - domain.length;
} while (page.nextPageToken);
console.log('domain (database)', domain);
domain = [];
page = undefined;
pageSize = 100;
do {
page = await filters[0].getDomainAsync('', pageSize, page?.nextPageToken, FilterDomainType.Relevant);
domain = domain.concat(page.values);
console.log(`Retrieved ${domain.length} of ${page.totalAvailable} field values`);
pageSize = page.totalAvailable - domain.length;
} while (page.nextPageToken);
console.log('domain (relevant)', domain);
domain = [];
page = undefined;
pageSize = 100;
do {
page = await filters[1].getDomainAsync('', pageSize, page?.nextPageToken, FilterDomainType.Relevant);
domain = domain.concat(page.values);
console.log(`Retrieved ${domain.length} of ${page.totalAvailable} field values`);
pageSize = page.totalAvailable - domain.length;
} while (page.nextPageToken);
console.log('domain (relevant)', domain);
domain = [];
page = undefined;
pageSize = 100;
do {
page = await filters[1].getDomainAsync('foo', pageSize, page?.nextPageToken, FilterDomainType.Relevant);
domain = domain.concat(page.values);
console.log(`Retrieved ${domain.length} of ${page.totalAvailable} field values`);
pageSize = page.totalAvailable - domain.length;
} while (page.nextPageToken);
console.log('domain (foo)', domain);
};
Copy
```
```
--------------------------------
### Launch Analytics Assistant in Tableau
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/AuthoringViz.html
Use this method to launch the Analytics Assistant side pane. Check availability with `isAnalyticsAssistantAvailableAsync()` before launching.
```javascript
const isAnalyticsAssistantAvailable = await viz.isAnalyticsAssistantAvailableAsync();
if (isAnalyticsAssistantAvailable) {
await viz.launchAnalyticsAssistantAsync();
}
```
--------------------------------
### Export Visualization as Image
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/Viz.html
Use `exportImageAsync` to download the current visualization as a PNG file. This is equivalent to clicking 'Download > Image' from the toolbar.
```javascript
viz.exportImageAsync();
```
--------------------------------
### Handling UrlActionEvent
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/UrlActionEvent.html
Example of how to listen for and handle the TableauEventType.UrlAction event using an event listener.
```APIDOC
```javascript
function urlActionEventHandler(event) {
console.log('URL: ' + event.detail.url);
console.log('Target: ' + event.detail.target);
}
let viz = document.getElementById('tableauViz');
viz.addEventListener(TableauEventType.UrlAction, urlActionEventHandler);
```
```
--------------------------------
### Using the `` Web Component
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_web_authoring.html
Embed a web authoring view by using the `` web component. This is the simplest method for embedding and initializing the Embedding API.
```APIDOC
## Using the `` Web Component
### Description
Embed a web authoring view by using the `` web component. This is the simplest method for embedding and initializing the Embedding API.
### HTML Structure
```html
```
### Attributes
- **id** (string) - Required - Identifies the instance of the web component. Used for programmatic access.
- **src** (string) - Required - The URL of the view on Tableau Server. Must use HTTPS.
```
--------------------------------
### Get filters
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_filter.html
Retrieve the collection of filters applied to a workbook or worksheet using `getFiltersAsync`.
```APIDOC
## Get filters
You can use the `getFiltersAsync` methods to retrieve the collection of filters in a workbook. The `dashboard.getFiltersAsync` method returns the list of filters used on the dashboard. The `worksheet.getFiltersAsync` method returns the list of filters in a worksheet. From the filters returned, you can use the filter properties to determine the filter types and their applied values.
```
--------------------------------
### getSummaryColumnsInfoAsync
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/Worksheet.html
Gets information about the columns that are returned by getSummaryDataAsync or getSummaryDataReaderAsync. Columns are sorted as they appear in the view.
```APIDOC
## getSummaryColumnsInfoAsync
### Description
Gets the columns that are returned with `getSummaryDataAsync` or `getSummaryDataReaderAsync`. The columns are sorted in the order that they appear in the view or in the View Data window. Note that `getSummaryDataReaderAsync` returns the summary data sorted with the columns in alphabetical (ascending) order. You can use method to determine the view order.
### Method
GET
### Endpoint
/api/v1/worksheets/{worksheetId}/summary/columns
### Returns
Promise
The array of columns that describe the data in the worksheet.
```
--------------------------------
### getDataSourcesAsync
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/Worksheet.html
Gets the data sources associated with this worksheet. Be aware that this method may impact performance.
```APIDOC
## getDataSourcesAsync
### Description
Gets the data sources for this worksheet. Note that calling this method might negatively impact performance and responsiveness of the viz that you are embedding. The method is partly asynchronous but includes some serial operations.
### Method
GET
### Endpoint
/api/v1/worksheets/{worksheetId}/datasources
### Returns
Promise
The primary data source and all of the secondary data sources for this worksheet. By convention the first data source in the array is the primary.
### Example
```javascript
let vizActiveSheet = viz.workbook.activeSheet;
if (vizActiveSheet.sheetType === "worksheet") {
let dataSources = await vizActiveSheet.getDataSourcesAsync();
console.log(dataSources[0].name);
let dataSource = dataSources.find(datasource => datasource.name === "Sample - Superstore");
// process the dataSource
}
```
```
--------------------------------
### AuthoringViz Methods
Source: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/AuthoringViz.html
This section details the methods available on the AuthoringViz interface for controlling and querying the visualization.
```APIDOC
## getCurrentSrcAsync
### Description
Gets the visualization's current URL.
### Method
getCurrentSrcAsync(): Promise
### Returns
Promise
## isAnalyticsAssistantAvailableAsync
### Description
Indicates whether the Analytics Assistant side pane is available.
### Method
isAnalyticsAssistantAvailableAsync(): Promise
### Returns
Promise
## launchAnalyticsAssistantAsync
### Description
Use this method to launch the Analytics Assistant side pane. You can use the `isAnalyticsAssistantAvailableAsync()` method to check if the Analytics Assistant is available for use.
### Method
launchAnalyticsAssistantAsync(): Promise
### Example
```javascript
const isAnalyticsAssistantAvailable = await viz.isAnalyticsAssistantAvailableAsync();
if (isAnalyticsAssistantAvailable) {
await viz.launchAnalyticsAssistantAsync();
}
```
### Returns
Promise
## resize
### Description
Use this method to readjust the dimensions of the embedded viz in response to things like a window resize, device orientation change, or parent container resize.
### Method
resize(): void
### Example
```javascript
window.addEventListener('resize', () => viz.resize());
new ResizeObserver(() => viz.resize()).observe(viz.parentElement);
```
### Returns
void
## setAuthToken
### Description
Provide an auth token for salesforce native mode
### Method
setAuthToken(token: string): void
### Parameters
#### Path Parameters
- **token** (string) - Required - The authentication token.
### Returns
void
```
--------------------------------
### Get Time Dimension
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_pulse_filter.html
Retrieves the currently applied time dimension using the `getTimeDimensionAsync` method.
```APIDOC
## Get time dimension (`getTimeDimensionAsync`)
You can use the `getTimeDimensionAsync` method to retrieve the currently applied time dimension.
### Method
`getTimeDimensionAsync()`
### Description
Asynchronously retrieves the current time dimension applied to the pulse data.
### Request Example
```javascript
// assumes a Pulse object has been created
// assumes the getTimeDimension() method is called from an `async` function
const timeDimension = await tableauPulse.getTimeDimensionAsync();
console.log('timeDimension', timeDimension);
```
### Response
- **timeDimension** (object) - An object representing the current time dimension.
```
--------------------------------
### Initialize TableauViz Object (JavaScript)
Source: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_migration_guide.html
Use this method to initialize the v3 API with more flexibility, similar to v2. You need to reference an HTML element to append the embedded viz. Creating the object does not render the view; it must be added to the DOM.
```html
```
```javascript
const viz = new TableauViz();
viz.src = 'https://my-server/views/my-workbook/my-view';
viz.toolbar = 'hidden';
document.getElementById('tableauViz').appendChild(viz);
```