server-client-python icon indicating copy to clipboard operation
server-client-python copied to clipboard

Unable to get usage statistics for workbook

Open tnorlund-dsc opened this issue 3 years ago • 6 comments

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

tnorlund-dsc avatar Jan 17 '23 19:01 tnorlund-dsc

Could you explain what you mean by "this no longer works"? What did you see before, and what do you get now instead?

jacalata avatar Jan 19 '23 21:01 jacalata

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?

tnorlund-dsc avatar Jan 19 '23 22:01 tnorlund-dsc

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

alexepperly avatar Feb 02 '23 19:02 alexepperly

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.

jacalata avatar Feb 04 '23 08:02 jacalata

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)]

jacalata avatar Feb 15 '23 06:02 jacalata

Any update on this? Any way I could help?

tnorlund-dsc avatar May 01 '23 23:05 tnorlund-dsc