Skip to content

400003: Bad Request Payload is either malformed or incomplete #990

Closed
@jasonusaco

Description

@jasonusaco

Here's my code:

import tableauserverclient as TSC
import logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
                    filename="tsc.log", level="DEBUG")

tableau_auth = TSC.TableauAuth('xxx', 'xxx', site_id='xxx')
server = TSC.Server('https://prod-apnortheast-a.online.tableau.com')

server.auth.sign_in(tableau_auth)

# create new user
newU = TSC.UserItem('Mike', 'Viewer')
server.users.add(newU)

print(newU.name, newU.site_role)

I just tried to use the api to add a new user, but it returns this:

Traceback (most recent call last):
  File "D:\Application\Anaconda\envs\new_ticket_auto\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 88, in _check_status
    raise ServerResponseError.from_response(server_response.content, self.parent_srv.namespace)
tableauserverclient.server.endpoint.exceptions.ServerResponseError: 

	400003: Bad Request
		Payload is either malformed or incomplete

and the tsc.log file return:

14:58:33,309 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): prod-apnortheast-a.online.tableau.com:443
2022-02-15 14:58:35,128 - urllib3.connectionpool - DEBUG - https://prod-apnortheast-a.online.tableau.com:443 "POST /api/3.14/auth/signin HTTP/1.1" 200 360
2022-02-15 14:58:35,135 - tableau.endpoint.auth - INFO - Signed into https://prod-apnortheast-a.online.tableau.com as user with id 10c3b3f3-9630-4f5e-ba82-xxxxxxxxx
2022-02-15 14:58:35,136 - tableau.endpoint - DEBUG - request post, url: https://prod-apnortheast-a.online.tableau.com/api/3.14/sites/a48e73ae-c557-4887-b07a-yyyyyyyy/users
2022-02-15 14:58:35,136 - tableau.endpoint - DEBUG - request content: b'<tsRequest><user name="Mike" siteRole="Viewer" /></tsRequest>'
2022-02-15 14:58:36,472 - urllib3.connectionpool - DEBUG - https://prod-apnortheast-a.online.tableau.com:443 "POST /api/3.14/sites/a48e73ae-c557-4887-b07a-yyyyyyyyy/users HTTP/1.1" 400 373

Can anyone help?

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedA user needs help, may be a mistake, a bug or a feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions