You can control the type and amount of data that gets returned from requests to the following REST APIÂ endpoints:
Get Users on Site
Query Datasources
Query Views for Site
Query Workbooks for Site
Query Projects
Query Jobs
Query Groups
Get Favorites for user
List Custom Views
List Metrics for Site
Fields are the named elements and attributes associated with Tableau Server resources, such as workbooks, data sources, projects, views, and owners. For example, the fields of the workbooks
resource includes the workbook id
, the workbook name
. Depending upon the resource, the fields can include additional attributes and elements for child or sub-resources, such as the project name (project.name
) and id (project.id
), and description (project.description
), .or owner attributes, and tags .
By default, methods like Query Workbooks for Site return information about all of the workbooks on a Tableau Server site. If you are only interested in a subset of these, for example the names of the workbooks, you could search through the response data for the workbook names. But if there are a large number of workbooks, you could be looking through pages of data. You could filter the response data by using filtering and sorting, but that requires that you know what the names are to setup the filters. Starting in REST APIÂ 2.5 (Tableau 10.2), you can add field expressions to the query string of the URI. By adding a field expression, you can tailor the response to return only the data for the resource elements you are interested in.
You add a field expression as a query string using the following general format:
<URI>?fields=<field-expression>
For example, you could use a field expression to query a Tableau Server for the just the names of the workbooks:
http://localhost/api/2.5/sites/1a10f5b9-029b-43e4-a620-773d1690338c/workbooks?fields=name
In this case, the method queries a Tableau Server site and only the names of workbooks are returned in the response packet.
<tsResponse http://tableau.com/api/ts-api-2.5.xsd"> <pagination pageNumber="1" pageSize="100" totalAvailable="11" /> <workbooks> <workbook name="Superstore" /> <workbook name="Regional" /> <workbook name="Backgrounder" /> <workbook name="ClusterController" /> <workbook name="Config" /> <workbook name="VizqlServer" /> <workbook name="Netstat" /> <workbook name="Apache" /> <workbook name="VizqlDesktop" /> </workbooks> </tsResponse>Creating field expressions
You can create field expressions to use with a set of RESTÂ APIÂ query methods for Tableau Server resources. The resources are workbooks, data sources, views, and users. Each resource has a set of fields (for example, the name or id of a workbook or owner. In addition, each resource can contain additional elements (or sub-resources). For example, a workbook contains project resource. You can combine fields and resources to create complex field expressions. For example, you can query for the names of all the workbooks and the names of the projects associated with those workbooks.
Field expression syntaxA field expression has the following syntax:
fields=[keyword,][field, |Â resource, | resource.field,]...
Note:Â Field names, keywords, and resources are case sensitive.
keyword
(Optional) The keyword
option can take two values. If you do not specify a field expression with your query, the response returns a default set of fields. If specified, the keyword
must appear as the first value in the field expression.
_all_
Returns all the available fields for the requested resource and any additional nested-resources. You can use this value to determine what the available fields are for a given resource. _default_Â
Returns the default fields for the requested resource and the default fields for any additional nested resources. The default fields are the same fields that are returned by the query method before any field expression is added. You can combine the _default_
keyword in field expressions with additional fields or resources to return all the default fields and ones that are not part of the default set (for example, Fields=_default_,owner.name
).
field
Specifies the element of the resource that should be returned from the query. The fields that are available depend upon the method and resource that is the object of the query, and whether the query keyword
asks for all fields (_all_)
or the default fields (_default_
).
resource
Specifies the additional (or nested) resource that should be returned from the query. The additional resources depend upon the method and resource that is the object of the query, and whether the query keyword
asks for all fields (_all_)
or the default fields (_default_
). You do not need to specify the resource already queried by the method. For example, if you use Query Workbooks for Site, you do not need to specify workbook
as a resource.
The following table shows the fields and resources that are available for the currently supported endpoints. The default fields and resources are included when you call the method without a field expression, or when you specify the keyword _default_
in the field expression. Additional fields are returned when you use the _all_
keyword in the field expression.
To specify fields for the supported resources, you use the dot notation, for example, project.id
or owner.siteRole
.
To specify non-default fields that are elements of a resource, such as the name of the owner of a project or the id of a workbook containing a specified view, you can combine the default keyword with additional fields to return just the information you are interested in (for example, ?fields=_default_,owner.name
)
Datasource
Use either:datasource.field
or: field
contentUrl
id
name
type
description
createdAt
updatedAt
encryptExtracts
isCertified
useRemoteQueryAgent
webPageUrl
size
tag
favoritesTotal
databaseName
connectedWorkbooksCount
hasAlert
hasExtracts
isPublished
serverName
Owner
Use:_default_,owner.sub-field
owner.id
owner.name
owner.fullName
owner.siteRole
owner.lastLogin
owner.email
Project
Use:_default_,project.sub-field
project.id
project.name
project.description
User
Use either:user.field
or field
externalAuthUserId
id
name
siteRole
lastLogin
fullName
email
For servers configured with
site-specific SAML(Link opens in a new window): authSetting
View
Use either:view.field
or field
id
name
contentUrl
createdAt
updatedAt
tags
sheetType
usage
Workbook
Use:_default_,workbook.sub-field
workbook.id
workbook.description
workbook.name
workbook.contentUrl
workbook.showTabs
workbook.size
workbook.createdAt
workbook.updatedAt
workbook.sheetCount
workbook.hasExtracts
workbook.tags
Owner
Use:_default_,owner.sub-field
owner.id
owner.name
owner.fullName
owner.siteRole
owner.lastLogin
Â
owner.email
Project
Use:_default_,project.sub-field
project.id
project.name
project.description
Workbook
Use either:workbook.field
or field
description
id
name
contentUrl
showTabs
webpageUrl
size
createdAt
updatedAt
encryptExtracts
defaultViewId
tag
sheetCount
hasExtracts
Owner
Use:_default_,owner.sub-field
owner.id
owner.name
owner.fullName
owner.siteRole
owner.lastLogin
owner.email
Project
Use:_default_,project.sub-field
project.id
project.name
project.description
Project
Use either:project.field
or field
id
name
description
createdAt
updatedAt
contentPermissions
parentProjectId
topLevelProject
writeable
Â
Owner
Use:_default_,owner.sub-field
owner.id
owner.name
owner.fullName
owner.siteRole
owner.lastLogin
owner.email
Â
Contents Counts
Use:_default_,contentsCounts.sub-field
contentsCounts.projectCount
contentsCounts.viewCount
contentsCounts.datasourceCount
contentsCounts.workbookCount
Background Job
Use either:job.field
or field
id
status
createdAt
startedAt
endedAt
priority
jobType
title
subtitle
Group
Use either:group.field
or field
id
name
domain name
userCount
minimumSiteRole
Favorites
Use either:favorite.field
or field
label
parentProjectName
targetOwnerName
Datasource
Use:_default_,datasource.sub-field
datasource.id
datasource.name
datasource.description
datsource.contentUrl
datasource.type
datasource.createdAt
datasource.updatedAt
datsource.encryptExtracts
datasource.isCertified
datasource.useRemoteQueryAgent
datasource.webpageUrl
datasource.serverName
datasource.databaseName
Project
Use:_default_,project.sub-field
project.id
project.name
project.description
User
Use:_default_,user.sub-field
Â
user.id
user.name
user.fullName
user.siteRole
LastLogin
Email
Workbook
Use:_default_,workbook.sub-field
Â
workbook.id
workbook.name
workbook.description
workbook.contentUrl
workbook.showTabs
workbook.tags
workbook.size
workbook.createdAt
workbook.updatedAt
sheetCount
hasExtracts
View
Use:_default_,view.sub-field
view.id
view.name
view.contentUrl
view.createdAt
view.updatedAt
List Metrics for Site Fields (Fields in bold face are included in the response by default.)
Metrics
Use either:metric.field
or field
id
name
Owner
Use:_default_,owner.sub-field
owner.id
owner.name
owner.fullName
owner.siteRole
owner.lastLogin
owner.email
Project
Use:_default_,owner.sub-field
project.id
project.name
project.description
List Custom Views Fields (Fields in bold face are included in the response by default.)
Custom Views
id
name
createdAt
updatedAt
shared
Â
Combining field expression with filtering and sortingYou can combine field expressions with filtering and sorting to further refine the data you want returned from the method. For example, you can filter on the date a workbook was last updated and then combine that with the field expression to return just the names of the workbooks that meet that criteria. You combine expressions using an ampersand (&). The URI and query string to return workbook names that were updated after a specified date might look like the following:
http://localhost/api/2.5/sites/1a10f5b9-029b-43e4-a620-773d1690338c/workbooks?filter=updatedAt:gte:2016-10-27T00:49:27Z&fields=name
Note that the fields supported by the ?filter=
and ?sort=
expressions might differ from the fields and resources that you can use in ?fields=
expressions. For information about the fields that can be used for filtering and sorting see, Filtering and Sorting in the Tableau RESTÂ API.
Example 1:Â The following URI shows the query to return just the id of the workbooks on the Tableau Server.
http://localhost/api/2.5/sites/1a10f5b9-029b-43e4-a620-773d1690338c/workbooks?fields=id
Example 2:Â The following example returns the default fields and the additional specified fields (owner name, project description) for the resource workbooks.
http://localhost/api/2.5/sites/1a10f5b9-029b-43e4-a620-773d1690338c/workbooks?fields=_default_,owner.name,project.description
Example 3:Â The following example returns the name of the workbooks and the default fields for the projects associated with the workbooks. In this case, the default fields are the project name and id. Â Because this URI queries the workbook resource, it is not necessary to specify workbook.name
. You could also use ?fields=name
.
http://localhost/api/2.5/sites/1a10f5b9-029b-43e4-a620-773d1690338c/workbooks?fields=workbook.name,project
Example 4:Â The following example combines the field expression and sorting. The query returns the names and usage data of the views and sorts the response by the workbook name.
http://localhost/api/2.5/sites/1a10f5b9-029b-43e4-a620-773d1690338c/views?fields=name,usage&sort=name:asc
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4