Unable to get usage statistics for workbook
Summary
I cannot use TSC to get the usage statistics for a specific workbook.
I'd like to get the usage statistics for a given workbook.
I can do this through postman, but not TSC.
GET 10az.online.tableau.com/api/-/content/usage-stats/workbooks/some_luid
How do I do this using TSC?
Description
tableau_auth = TSC.PersonalAccessTokenAuth(token_name, token, site_id="some_company")
server = TSC.Server("https://10az.online.tableau.com", use_server_version=True)
with server.auth.sign_in(tableau_auth):
workbook = server.workbooks.get_by_id('some_luid')
workbook._get_views_for_workbook() # this no longer works
Could you explain what you mean by "this no longer works"? What did you see before, and what do you get now instead?
I saw that the _get_views_for_workbook method has a parameter, usage, to get the usage statistics.
I've attempted to get the usage statistics using TSC, but I'm not able to. Am I doing this incorrectly?
I saw that the _get_views_for_workbook method has a parameter,
usage, to get the usage statistics.I've attempted to get the usage statistics using TSC, but I'm not able to. Am I doing this incorrectly?
Seconded. I am having this same issue. Doesn't seem to be possible through TSC, but possible through Postman
Got it - sorry, I totally skimmed over the example url in the first post. I'll have to check with the team that owns the feature on whether they knew/intended that this was broken, before I know how to update the library.
The usage parameter needs to be passed in to the populate_views() method, like this
server.workbooks.populate_views(sample_workbook, usage=True)
print("\nName of views in {}: ".format(sample_workbook.name))
print([(view.name, view.total_views) for view in sample_workbook.views])
The output I get from this code is Name of views in JungleBook: [('AnimalSightings', 44), ('Image Mapper - Jungle Book', 41)]
Any update on this? Any way I could help?