Dear Tableau Community
I am using Tableau Rest API [tableau_api_lib] to export pdf, but the pdf is not taking the latest data. Below is what I currently have:
1. Tableau Hyper API is used to publish the data
P_datasource = server.datasources.publish(P_datasource, PATH_TO_HYPER, 'Overwrite')
2. From tableau_api_lib, refresh workbook now is used
response = connection.update_workbook_now('#####')
3. Find the View Id [I only have one View]
4. use the API to extract pdf
view_png_pdf = connection.query_view_pdf(view_id=pdf_view_id, parameter_dict=pdf_params)
with open('Ticket_Summary_Report.pdf','wb') as file:
file.write(view_png_pdf.content)
I am not sure what is missing that caused the pdf to be not updated. Although, on the site, the data is updated
Kindly find attached the code used. Some parts were shared to XXXX as it is sensitive data
This will probably help, I use it all the time:
https://kb.tableau.com/articles/issue/rest-api-query-view-image-does-not-refresh-view-cache
-----------------------------------------------------------
2022 Tableau Forums Ambassador
Based in Sydney, Australia (GMT+11)
Please upvote my helpful replies and choose Select as Best Answer if it really is the best :)