當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。