1. Hi there! Thanks for the awesome write up and for the work on tableau_rest_api. I’m trying to make use of it to automate the deploy of our datasources. I can sign in, list data sources and projects, but when I try to publish a datasource (in a way almost identical to your first example) I get the following error output. I was wondering if you have ever run across something like this.

    Traceback (most recent call last):
    File “~/python/rest-api-python-sample/publishDataSource.py”, line 32, in
    a.publish_datasource(‘headcount.tds’, ‘headcount’, DEFAULT_PROJECT_ID, overwrite=True, connection_username=”,connection_password=”)
    File “build/bdist.macosx-10.10-x86_64/egg/tableau_rest_api/tableau_rest_api.py”, line 1407, in publish_datasource
    File “build/bdist.macosx-10.10-x86_64/egg/tableau_rest_api/tableau_rest_api.py”, line 1511, in publish_content
    File “build/bdist.macosx-10.10-x86_64/egg/tableau_rest_api/tableau_rest_api.py”, line 343, in send_publish_request
    File “build/bdist.macosx-10.10-x86_64/egg/tableau_rest_api/tableau_rest_api.py”, line 1701, in request_from_api
    File “build/bdist.macosx-10.10-x86_64/egg/tableau_rest_api/tableau_rest_api.py”, line 1669, in __make_request
    File “/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 437, in open
    response = meth(req, response)
    File “/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 550, in http_response
    ‘http’, request, response, code, msg, hdrs)
    File “/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 475, in error
    return self._call_chain(*args)
    File “/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 409, in _call_chain
    result = func(*args)
    File “/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 558, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
    urllib2.HTTPError: HTTP Error 400: Bad Request

    I’ve also experimented using Postman to issue the POST requests using the request body generated by tableau_rest_api. I get a 400 Bad Request, “Your browser sent a request that this server could not understand.” response.

    Any input would be greatly appreciated 🙂



    1. Hi Drew,
      If you aren’t uploading credentials, then you can just drop out the connection_username= and connection_password= arguments. Otherwise they need some kind of values — the method itself that builds the XML expects a python None rather than empty strings. If you are putting in values there and just leaving them out for obfuscation, then there may be something else going on. What is appearing in the log files, those should be capturing all of the XML requests that are attempted.


      1. Thanks for the pointers! I removed the connection username and password in the publish_datasource command, but I’m still getting the same error. The actual POST request looks ok via the logs for what it’s worth. The end of the log file has the response below:

        2015-07-10 10:46:12: HTTP verb is post
        2015-07-10 10:46:12: Making REST request to Tableau Server using post
        2015-07-10 10:46:12: Request URI: https://tableau-test.redfintest.com/api/2.0/sites/695a28d9-f7e7-494e-be47-fb365a7cbb0d/datasources?overwrite=true
        2015-07-10 10:46:13: Received a 400 error, here was response:
        2015-07-10 10:46:13:

        Bad Request
        There was a problem publishing the file ‘headcount.tds’.

        Any additional thoughts?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s