Skip to main content
bhavana K asked in #Print

Hi Everybody,

 

I am super new in API Section, I am writing api using python. I installed Postman and I just want to try simple sign in. So by following this article https://onlinehelp.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm⌗sign_in

 

I simply put this /api/api-version/auth/signin version in my postman with post request like this https://tableauServer/api/3.3/auth/signin    where 3.3 because I am using Tableau Server version 2019.1.2 and with my username and password of tableau Server and when I run it I get error bad request

 

Rest API Bad Request error

 

What is it I'm missing? Can anybody please help...In Postman itself i'm giving username and password is it enough? or should i add it in url only? 

Like this https://tableauServer/api/3.3/auth/signin?username='name'&password='pass'&content-url='text/xml'

 

and I have installed python 3.7v but I wrote a simple program in it and it was giving me SSL error, so my colleague suggested me to install postman and just check if I can at least connect to tableau server through postman so i tried and it doesn't give me any error.  but when i run this signin thing it gives me this error, now what to do? I think I am heading in wrong direction with very little help, any suggestions/solutions will be very helpful.

 

Thanks,

Bhavana

5 answers
  1. May 7, 2019, 1:26 PM

    Hi Bhavana,

     

    You only want to use Postman for testing; it is not a tool for production work. I have used the REST api natively, but if you can use the TSC Python library you definitely should!

     

    Using the Python library is quite simple.

    If you want to remove all unlicensed users this should work:

     

    import tableauserverclient as TSC

    tableau_auth = TSC.TableauAuth('USER', 'PASSWORD')

    server = TSC.Server('SERVER')

     

    with server.auth.sign_in(tableau_auth):

      all_users, pagination_item = server.users.get()

       for user in all_users:

            print(user.name)

            print(user.site_role)

            if (user.site_role == 'Unlicensed'):

                 print(user.id)

                 server.users.remove(user.id)

                 print("user deleted") 

     

    This is dangerous - so make sure to test it and make backups!

     

    Kind regards

    Johan de Groot

0/9000