当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python Tableau subscription.create用法及代码示例


Tableau Server Client (TSC)subscription.create的用法。

用法

subscription.create(subscription_item)

按特定计划为特定用户创建对视图或工作簿的订阅。当用户订阅内容时,Tableau Server 会按照在 Tableau Server 上定义并在 subscription_item 中指定的计划通过电子邮件将内容发送给用户。

要创建新订阅,您需要首先创建一个新的 subscription_item(来自 SubscriptionItem 类)。

REST API:Create Subscription

参数

名字 说明
subscription_item 指定要订阅的用户、要订阅的内容、与订阅相关联的计划以及订阅的其他元数据。

返回

返回新的 SubscriptionItem 对象。

示例

# Create the target (content) of the subscription with its ID and type.
# ID can be obtained by calling workbooks.get() or views.get().
target = TSC.Target('c7a9327e-1cda-4504-b026-ddb43b976d1d', 'workbook')

# Store the schedule ID and user ID.
# IDs can be obtained by calling schedules.get() and users.get().
schedule_id = 'b60b4efd-a6f7-4599-beb3-cb677e7abac1'
user_id = '28ce5884-ed38-49a9-aa10-8f5fbd59bbf6'

# Create the new SubscriptionItem object with variables from above.
new_sub = TSC.SubscriptionItem('My Subscription', schedule_id, user_id, target)

# (Optional) Set other fields. Any of these can be added or removed.
new_sub.attach_image = False
new_sub.attach_pdf = True
new_sub.message = "You have an alert!"
new_sub.page_orientation = TSC.PDFRequestOptions.Orientation.Landscape
new_sub.page_size_option = TSC.PDFRequestOptions.PageType.B4
new_sub.send_if_view_empty = True

# Create the new subscription on the site you are logged in.
new_sub = server.subscriptions.create(new_sub)
print(new_sub.subject)



相关用法


注:本文由纯净天空筛选整理自tableau.github.io大神的英文原创作品 subscription.create。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。