Import ask data lens - Retired in API 3.22

POST {{baseUrl}}/api/-/askdata/lenses/import


Retired in API 3.22 (Cloud February 2024 / Server 2024.2)

In February 2024, Tableau's Ask Data and Metrics features and their REST API methods will be retired in Tableau Cloud and Tableau Server version 2024.1. With advances in natural language technologies, we're developing an improved interface that will make it easier to ask questions of your data and stay on top of changes. For more information, see How Tableau GPT and Tableau Pulse are reimagining the data experience.


Import an existing ask data lens on a server to a site, and optionally transform the metadata of the lens in the process.

Version: Available in API 3.16 ( Tableau Cloud June 2022 / Server 2022.3) and later. Versioning Overview

Permissions: This method can only be called by server administrators or site administrators. Permissions Overview

License: No additional license required.

Access Scope: tableau:lenses:create
Access Scopes Overview: Cloud | Server-Windows | Server-Linux

The request and response bodies for a lens import each have two parts: the first describes the attributes of the lens being imported, and the second describes transformations, which are changes to the lens metadata, to apply during import.

Use the entire response object from a request to the Get ask data lens method in your import request body.

Lens attributes that can optionally be transformed include name, data source, project, and owner. The original metadata of a lens is replaced by the transformation metadata in the new project the lens is imported to. While lens_transformation is optional in an import request, a transformation definition will be needed in most cases.

Example transformation use cases

  • To publish a lens to a new site with modified metadata, sign in to the new site and include the following in your request: "lens_transformations": { "datasource_id": "<data_source_LUID_in_new_site>", "project_id": "<project_LUID_in_new_site>", "owner_id": "<lens_owner_LUID_in_new_site>" "name": "<new name of the lens>", "description": "<new description of the lens>", }

  • To publish a lens to a different project in the same site, while signed in to the site, use: "lens_transformations": { "project_id": "new project id", }

Request Body

{"lens"=>{"id"=>"<string>", "name"=>"<string>", "site_id"=>"<string>", "datasource_id"=>"<string>", "project_id"=>"<string>", "owner_id"=>"<string>", "description"=>"<string>", "repository_url"=>"<string>", "is_feedback_enabled"=>"<boolean>", "fields"=>[{"graph_id"=>"<string>", "custom_label"=>"<string>", "custom_description"=>"<string>", "field_synonyms"=>["<string>", "<string>"], "inherited_field_synonyms"=>["<string>", "<string>"], "value_synonyms"=>[{"value"=>"<string>", "synonyms"=>["<string>", "<string>"]}, {"value"=>"<string>", "synonyms"=>["<string>", "<string>"]}], "inherited_value_synonyms"=>[{"value"=>"<string>", "synonyms"=>["<string>", "<string>"]}, {"value"=>"<string>", "synonyms"=>["<string>", "<string>"]}]}, {"graph_id"=>"<string>", "custom_label"=>"<string>", "custom_description"=>"<string>", "field_synonyms"=>["<string>", "<string>"], "inherited_field_synonyms"=>["<string>", "<string>"], "value_synonyms"=>[{"value"=>"<string>", "synonyms"=>["<string>", "<string>"]}, {"value"=>"<string>", "synonyms"=>["<string>", "<string>"]}], "inherited_value_synonyms"=>[{"value"=>"<string>", "synonyms"=>["<string>", "<string>"]}, {"value"=>"<string>", "synonyms"=>["<string>", "<string>"]}]}], "recommended_visualization_groups"=>[{"name"=>"<string>", "description"=>"<string>", "recommended_visualizations"=>[{"expression"=>"<string>", "interpretation"=>"<string>", "colloquial_alias"=>"<string>"}, {"expression"=>"<string>", "interpretation"=>"<string>", "colloquial_alias"=>"<string>"}]}, {"name"=>"<string>", "description"=>"<string>", "recommended_visualizations"=>[{"expression"=>"<string>", "interpretation"=>"<string>", "colloquial_alias"=>"<string>"}, {"expression"=>"<string>", "interpretation"=>"<string>", "colloquial_alias"=>"<string>"}]}]}, "lens_transformations"=>{"name"=>"<string>", "description"=>"<string>", "datasource_id"=>"<string>", "project_id"=>"<string>", "owner_id"=>"<string>"}}

HEADERS

KeyDatatypeRequiredDescription
X-Tableau-AuthstringThe Tableau authentication header. The value is a credentials token from a Tableau server's response to an authentication request.
The Content-Type and Accept headers should be the mediatype of the request and response except in cases where you want to explicitly allow other versions of the resource.
Content-Typestring
Acceptstring

RESPONSES

status: Created

{&quot;lens&quot;:{&quot;id&quot;:&quot;\u003cstring\u003e&quot;,&quot;name&quot;:&quot;\u003cstring\u003e&quot;,&quot;site_id&quot;:&quot;\u003cstring\u003e&quot;,&quot;datasource_id&quot;:&quot;\u003cstring\u003e&quot;,&quot;project_id&quot;:&quot;\u003cstring\u003e&quot;,&quot;owner_id&quot;:&quot;\u003cstring\u003e&quot;,&quot;description&quot;:&quot;\u003cstring\u003e&quot;,&quot;repository_url&quot;:&quot;\u003cstring\u003e&quot;,&quot;is_feedback_enabled&quot;:&quot;\u003cboolean\u003e&quot;,&quot;fields&quot;:[{&quot;graph_id&quot;:&quot;\u003cstring\u003e&quot;,&quot;custom_label&quot;:&quot;\u003cstring\u003e&quot;,&quot;custom_description&quot;:&quot;\u003cstring\u003e&quot;,&quot;field_synonyms&quot;:[&quot;\u003cstring\u003e&quot;,&quot;\u003cstring\u003e&quot;],&quot;inherited_field_synonyms&quot;:[&quot;\u003cstring\u003e&quot;,&quot;\u003cstring\u003e&quot;],&quot;value_synonyms&quot;:[{&quot;value&quot;:&quot;\u003cstring\u003e&quot;,&quot;synonyms&quot;:[&quot;\u003cstring\u003e&quot;,&quot;\u003cstring\u003e&quot;]},{&quot;value&quot;:&quot;\u003cstring\u003e&quot;,&quot;synonyms&quot;:[&quot;\u003cstring\u003e&quot;,&quot;\u003cstring\u003e&quot;]}],&quot;inherited_value_synonyms&quot;:[{&quot;value&quot;:&quot;\u003cstring\u003e&quot;,&quot;synonyms&quot;:[&quot;\u003cstring\u003e&quot;,&quot;\u003cstring\u003e&quot;]},{&quot;value&quot;:&quot;\u003cstring\u003e&quot;,&quot;synonyms&quot;:[&quot;\u003cstring\u003e&quot;,&quot;\u003cstring\u003e&quot;]}]},{&quot;graph_id&quot;:&quot;\u003cstring\u003e&quot;,&quot;custom_label&quot;:&quot;\u003cstring\u003e&quot;,&quot;custom_description&quot;:&quot;\u003cstring\u003e&quot;,&quot;field_synonyms&quot;:[&quot;\u003cstring\u003e&quot;,&quot;\u003cstring\u003e&quot;],&quot;inherited_field_synonyms&quot;:[&quot;\u003cstring\u003e&quot;,&quot;\u003cstring\u003e&quot;],&quot;value_synonyms&quot;:[{&quot;value&quot;:&quot;\u003cstring\u003e&quot;,&quot;synonyms&quot;:[&quot;\u003cstring\u003e&quot;,&quot;\u003cstring\u003e&quot;]},{&quot;value&quot;:&quot;\u003cstring\u003e&quot;,&quot;synonyms&quot;:[&quot;\u003cstring\u003e&quot;,&quot;\u003cstring\u003e&quot;]}],&quot;inherited_value_synonyms&quot;:[{&quot;value&quot;:&quot;\u003cstring\u003e&quot;,&quot;synonyms&quot;:[&quot;\u003cstring\u003e&quot;,&quot;\u003cstring\u003e&quot;]},{&quot;value&quot;:&quot;\u003cstring\u003e&quot;,&quot;synonyms&quot;:[&quot;\u003cstring\u003e&quot;,&quot;\u003cstring\u003e&quot;]}]}],&quot;recommended_visualization_groups&quot;:[{&quot;name&quot;:&quot;\u003cstring\u003e&quot;,&quot;description&quot;:&quot;\u003cstring\u003e&quot;,&quot;recommended_visualizations&quot;:[{&quot;expression&quot;:&quot;\u003cstring\u003e&quot;,&quot;interpretation&quot;:&quot;\u003cstring\u003e&quot;,&quot;colloquial_alias&quot;:&quot;\u003cstring\u003e&quot;},{&quot;expression&quot;:&quot;\u003cstring\u003e&quot;,&quot;interpretation&quot;:&quot;\u003cstring\u003e&quot;,&quot;colloquial_alias&quot;:&quot;\u003cstring\u003e&quot;}]},{&quot;name&quot;:&quot;\u003cstring\u003e&quot;,&quot;description&quot;:&quot;\u003cstring\u003e&quot;,&quot;recommended_visualizations&quot;:[{&quot;expression&quot;:&quot;\u003cstring\u003e&quot;,&quot;interpretation&quot;:&quot;\u003cstring\u003e&quot;,&quot;colloquial_alias&quot;:&quot;\u003cstring\u003e&quot;},{&quot;expression&quot;:&quot;\u003cstring\u003e&quot;,&quot;interpretation&quot;:&quot;\u003cstring\u003e&quot;,&quot;colloquial_alias&quot;:&quot;\u003cstring\u003e&quot;}]}]}}