Complete the code to publish a workbook to Tableau Server using Tableau's REST API.
server = TableauServerConnection(server='https://mytableauserver.com', username='user', password='pass') server.[1]()
You must first connect to the Tableau Server before performing any actions like publishing.
Complete the code to publish a workbook file named 'Sales.twbx' to a specific project on Tableau Server.
server.publish_workbook(workbook_file='Sales.twbx', project_id=[1], mode='overwrite')
The project_id must be the unique identifier of the target project on Tableau Server, such as '67890'.
Fix the error in the code to properly publish a workbook with overwrite mode.
server.publish_workbook(workbook_file='Dashboard.twbx', project_id='54321', mode=[1])
The mode parameter is case-sensitive and must be 'overwrite' in lowercase to work correctly.
Fill both blanks to set permissions for a published workbook to allow viewing and editing.
permissions = {
'view': [1],
'edit': [2]
}To allow users to view and edit, set 'view' permission to 'Allow' and 'edit' permission to 'Write'.
Fill all three blanks to disconnect from Tableau Server and confirm the session is closed.
server.[1]() if not server.[2]: print('Session [3] closed successfully')
Call disconnect() to end the session, check is_connected property, and confirm with message that session has_been closed.