4 Replies Latest reply on Sep 13, 2016 12:20 PM by diego.medrano

    Updating existing user using REST API 2.2

    Venkatesh Mandalapa

      We have Tableau Server 9.3. I'm trying to use a Python script to update full name, email and password for an existing user with the 'Publisher' site role. I'm a site administrator (not a server admin) and it looks like I'm allowed to use the Update User REST API with my privilege level according to the docs. The script is able to use my Site Admin credentials to log in to our Tableau site successfully. I get the token and construct the PUT request and issue the REST call and I'm greeted with the following error. Looking up the error code, there's three different reasons but none of them apply to me. Interestingly, I'm able to go into the Tableau Portal using a browser and update the user's name, email and password. Any idea why the REST API is not working in my case?


      An error occurred
              Error code: 403009
              Error detail: User 'user@upn' is unauthorized to update user 'bbf45987-93b4-42ff-b0c2-28474de7b7e7'.


      Code snippet below to update just the full name;


          url = SERVER + "/api/2.2/sites/{0}/users/bbf45987-93b4-42ff-b0c2-28474de7b7e7".format(SITE_ID)
          xml_payload_for_request = ET.Element('tsRequest')
          user = ET.SubElement(xml_payload_for_request, 'user', fullName='Test Data')
          xml_payload_for_request = ET.tostring(xml_payload_for_request)
          server_response = requests.put(url, data=xml_payload_for_request, headers={'x-tableau-auth': TOKEN})


      Thank you,