Repository navigation
Closed
Labels
Description
There is no way to populate the UserItem.email field on a get request.
Using the .get() all users method:
import tableauserverclient as TSC
tableau_auth = TSC.TableauAuth('USERNAME', 'PASSWORD')
server = TSC.Server('https://SERVERURL')
with server.auth.sign_in(tableau_auth):
all_users, pagination_item = server.users.get()
for user_item in all_users:
print("User name: '{}' fullname: '{}', User email: '{}'".format(user_item.name,
user_item.fullname,
user_item.email))
# =>
# User name: 'username123' fullname: 'None', User email: 'None'
# User name: 'username124' fullname: 'None', User email: 'None'
# User name: 'username125' fullname: 'None', User email: 'None'
# User name: 'username126' fullname: 'None', User email: 'None'Using the .get_by_id() at least returns the fullname field, but still no email:
user_item = server.users.get_by_id('9f9e9d9c-8b8a-8f8e-7d7c-7b7a6f6d6e6d')
print("User name: '{}' fullname: '{}', User email: '{}'".format(user_item.name,
user_item.fullname,
user_item.email))
# =>
# User name: 'username123' fullname: 'User Name 123', User email: 'None'This is caused by the default return from the REST API
https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#get_users_on_site
and see here from the list of fields
https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_fields.htm#get-users_site
Using the ?fields= url param in the REST API could return the missing UserItem fields. However it seems at this time the TableauServerClient currently does not support adding fields to the request param.
Activity
RyanSnodgrass commentedon Feb 7, 2020
It seems maybe the
_make_request()method in the Endpoint class has support for parametersserver-client-python/tableauserverclient/server/endpoint/endpoint.py
Line 42 in a6cc77d
RyanSnodgrass commentedon Feb 7, 2020
I'm trying to hack my way through this.
This actually works!
RyanSnodgrass commentedon Feb 7, 2020
Feature request to add the fields we want returned from the
.get()and.get_by_id()methods.RyanSnodgrass commentedon Feb 7, 2020
Do you think changing the baseurl to have the
_all_fields by default is a good idea?My opinion is I find it annoying that the UserItem object returns different fields based on which get method you use. Nevermind that one field never returns.
Personally, I don't see much difference with only 2 more short fields(email and fullname) added to the object memory space. And even then most times developers are going to be using the pagination feature.
RyanSnodgrass commentedon Feb 10, 2020
I've found this only brings back the first 100 results due to the API's pagination.
hariszhr commentedon Mar 19, 2020
I m writing a production software, and need to update email and full name in some cases. This bug causes me to update those fields everytime, since those fields return 'None'.
I probably shouldnt hack my way through it. Waiting for a fix....
shinchris commentedon Dec 18, 2020
See #278 for updates