Skip to content

When creating User or modiying user I receive an error #1284

Closed as not planned

Description

@difemaro

Describe the bug
I am trying to create or modify a user, and I have not been able to. I receive different error.

Versions
Details of your environment, including:

  • Tableau Server version 2023.1.4
  • Python version 3.10.6
  • TSC library version: 0.25

To Reproduce
I am running two codes:
Code 1 Creating User

import tableauserverclient as TSC
 
TOKEN_NAME = "tokenname"
TOKEN = "S4dD5AVINzA==:aQp3EPJy09Cf3d"
SERVER_NAME = 'https://www.yourserver.com/'
SITE_NAME = 'yoursitename'
 
tableau_auth = TSC.PersonalAccessTokenAuth(TOKEN_NAME,TOKEN,SITE_NAME)
server = TSC.Server(SERVER_NAME, use_server_version=True)

with server.auth.sign_in(tableau_auth):
    print("Signed in")
    # create a new user_item
    user1 = TSC.UserItem('temp', 'Viewer')

    # add new user
    user1 = server.users.add(user1)
    print(user1.name, user1.site_role, user1.id)

    # modify user info
    user1.name = 'Laura'
    user1.fullname = 'Laura Rodriguez'
    user1.email = 'laura@example.com'

    # update user
    server.users.update(user1)
    print("Updated user info:")
    print(user1.name, user1.fullname, user1.email, user1.id)

# Sign out
server.auth.sign_out()  

Code 2 Modifying User

import tableauserverclient as TSC
 
TOKEN_NAME = "tokenname"
TOKEN = "S4dD5AVINzA==:aQp3EPJy09Cf3d"
SERVER_NAME = 'https://www.yourserver.com/'
SITE_NAME = 'yoursitename'
 
tableau_auth = TSC.PersonalAccessTokenAuth(TOKEN_NAME,TOKEN,SITE_NAME)
server = TSC.Server(SERVER_NAME, use_server_version=True)
NEW_DOMAIN = '@newdomain.com'
with server.auth.sign_in(tableau_auth):
   print("Signed in")
   for t in TSC.Pager(server.users):
        if t.site_role != "ServerAdministrator":
            email = t.email
            new_email = email.split("@")[0] + NEW_DOMAIN
            t.email = new_email
            server.users.update(t)

# Sign out
server.auth.sign_out()  

Results
For Code 1: User is created, but code exits with error
Traceback (most recent call last):
File "D:\Tableau Server\Todos\REST API\Update email\Create User.py", line 17, in
server.users.add(user1)
File "D:\Python\Python310\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 205, in wrapper
return func(self, *args, **kwargs)
File "D:\Python\Python310\lib\site-packages\tableauserverclient\server\endpoint\users_endpoint.py", line 77, in add
server_response = self.post_request(url, add_req)
File "D:\Python\Python310\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 162, in post_request
return self._make_request(
File "D:\Python\Python310\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 87, in _make_request
self._check_status(server_response, url)
File "D:\Python\Python310\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 102, in _check_status
raise ServerResponseError.from_response(server_response.content, self.parent_srv.namespace, url)
tableauserverclient.server.endpoint.exceptions.ServerResponseError:

    400003: Bad Request
            Payload is either malformed or incomplete

For Code 2:
Traceback (most recent call last):
File "D:\Tableau Server\Todos\REST API\Update email\Change_email.py", line 18, in
server.users.update(t)
File "D:\Python\Python310\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 205, in wrapper
return func(self, *args, **kwargs)
File "D:\Python\Python310\lib\site-packages\tableauserverclient\server\endpoint\users_endpoint.py", line 54, in update
server_response = self.put_request(url, update_req)
File "D:\Python\Python310\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 152, in put_request
return self._make_request(
File "D:\Python\Python310\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 87, in _make_request
self._check_status(server_response, url)
File "D:\Python\Python310\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 102, in _check_status
raise ServerResponseError.from_response(server_response.content, self.parent_srv.namespace, url)
tableauserverclient.server.endpoint.exceptions.ServerResponseError:

    400012: Bad Request
            There was a problem updating user '0bfd16b9-97bf-492e-a92a-ec9b87b31cd1'.

NOTE: Be careful not to post user names, passwords, auth tokens or any other private or sensitive information.

Activity

  1. added
    help wantedA user needs help, may be a mistake, a bug or a feature request
    on Jan 13, 2024
  2. github-actions commented on Aug 1, 2026

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. If this is still relevant, please comment to keep it open.

  3. github-actions commented on Aug 16, 2026

    @github-actions

    Closing due to inactivity. If this is still relevant, please reopen or file a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedA user needs help, may be a mistake, a bug or a feature requeststaletriagedReviewed by a maintainer; leave closed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions