tableau restapi

I can create user but RESTAPI does not allow direct update users credential!

How to update Users details using Tableau RESTAPI (including users credential)?
LVL 10
Prakash SamariyaIT ProfessionalAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vikas GargBusiness Intelligence DeveloperCommented:
hI,

Please try this

Modifies information about the specified user.

If Tableau Server is configured to use local authentication, you can update the user's name, email address, password, or site role.

If Tableau Server is configured to use Active Directory for authentication, you can change the user's display name (full name), email address, and site role. However, if you synchronize the user with Active Directory, the display name and email address will be overwritten with the information that's in Active Directory.

Any combination of the elements inside the <user> element is valid. Only those elements present will result in updates to their values for the user. If no elements are present, the update will not take effect.


URI
      

PUT /api/api-version/sites/site-id/users/user-id

Parameter Values
      
api-version       The version of the API to use, such as /2.0/. For more information, see REST API Versions.
site-id       The ID of the site that contains the user.
user-id       The ID of the user to update.

Request Body
      

<tsRequest>
 <user fullName="new-full-name"
    email="new-email"
    password="new-password"
    siteRole="new-site-role" />
</tsRequest>

Attribute Values
      
new-full-name       (Optional) The new name for the user. Users can change names without affecting the groups they belong to.
new-email       (Optional) The new email address for the user.
new-password       (Optional) The new password for the user.
new-site-role       (Optional) The new site role. Valid role names are Interactor, Publisher, SiteAdministrator, Unlicensed, UnlicensedWithPublish, Viewer, and ViewerWithPublish.

Note: You cannot use the REST API to set a user to be a system administrator (ServerAdministrator site role).

Permissions
      

This method can only be called by system administrators.

Response Code
      

200

Response Body
      

<tsResponse>
 <user name="user-name"
    fullName="new-full-name"
    email="new-email"
    siteRole="new-site-role" />
</tsResponse>

Version
      

Version 1.0 and later. For more information, see REST API Versions.

Errors
      
HTTP status       error Code       Condition       Details
400       400000       Bad request       The content of the request body is missing or incomplete, or contains malformed XML.
400       400000       Invalid email address       The email attribute does not contain a valid email address.
403       403009       Licensing update on self forbidden       A user cannot update their own licensing role.
403       403009       Guest update forbidden       The Guest user is a special user and cannot be updated.
403       403009       System administrator update forbidden       Only non-administrator users and site admininistrator users can be updated.
400       400013       Invalid site role       The value of the siteRole attribute must be Interactor, Publisher, SiteAdministrator, Unlicensed, UnlicensedWithPublish, Viewer, or ViewerWithPublish.
404       404000       Site not found       The site ID in the URI doesn't correspond to an existing site.
404       404002       User not found       The user ID in the URI doesn't correspond to an existing user.
405       405000       Invalid request method       Request type was not PUT.
409       409000       User conflict       The user with the specified name is already registered on the site in the same domain.
409       409014       Licensing conflict       The request is attempting to update the user to a licensing role that has insufficient capacity.

For more information, see Handling Errors.
Update Workbook

Modifies an existing workbook, allowing you to change the name, owner, or project that the workbook belongs to.


URI
      

PUT /api/api-version/sites/site-id/workbooks/workbook-id

Parameter Values
      
api-version       The version of the API to use, such as /2.0/. For more information, see REST API Versions.
site-id       The ID of the site that contains the workbook.
workbook-id       The ID of the workbook to update.

Request Body
      

<tsRequest>
  <workbook showTabs="show-tabs-flag"
     <project id="new-project-id" />
     <owner id="new-owner-id" />
 </workbook>
</tsRequest>

Attribute Values
      
show-tabs-flag       (Optional) Specify true to have the published workbook show views in tabs; otherwise, false. The default is false.
new-project-id       (Optional) The ID of a project to assign the workbook to.
new-owner-id       (Optional) The ID of a user to assign the workbook to as owner.

Any combination of the elements inside the <workbook> element is valid. Only the attributes and child elements that are included result in updates to the data source. If no attributes or nested elements are included, no update is made.

If the <project> element is included, the id attribute must be included; other attributes of the <project> element are ignored.

If the <owner> element is included, the id attribute must be included; other attributes of the <owner> element are ignored.

Permissions
      

Only a system administrator user can change a workbook's owner. Users who are not system administrators can update a workbook only if they have Write permission for the workbook and for the project.

Response Code
      

200

Response Body
      

<tsRequest>
  <workbook name="workbook-name" id="workbook-id"
        contentUrl="workbook-url" showTabs="show-tabs-flag" >
    <project id="new-project-id" />
    <owner id="new-owner-id" />
  </workbook>
</tsRequest>

Version
      

Version 2.0 and later. For more information, see REST API Versions.

Errors
      
HTTP status       error Code       Condition       Details
400       400000       Bad request       The content of the request body is missing or incomplete, or contains malformed XML.
403       403025       Project update forbidden       A non-administrator user tried to change the workbook project, but the caller doesn't have Write permission for the target project.
403       403027       Owner update forbidden       A non-administrator user tried to change the workbook owner.
403       403027       Update forbidden       A non-administrator user tried to change the workbook, but the caller doesn't have Write permission for the workbook.
404       404000       Site not found       The site ID in the URI doesn't correspond to an existing site.
404       404002       Owner not found       The owner ID in the request body doesn't correspond to an existing user.
404       404005       Project not found       The project ID in the URI doesn't match the project ID provided in the request body.
404       404006       Workbook not found       The workbook ID in the URI doesn't correspond to an existing workbook.
405       405000       Invalid request method       Request type was not PUT.

For more information, see Handling Errors.

Example
      

curl "http://MY-SERVER/api/2.0/sites/9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d/workbooks/1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d" -X PUT -H X-Tableau-Auth:12ab34cd56ef78ab90cd12ef34ab56cd -d @update-workbook.xml

This command changes a workbook whose ID is 1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d from its original project to a new project (7b6b59a8-ac3c-4d1d-2e9e-0b5b4ba8a7b6). The new project ID is specified in the update-workbook.xml file.

Content of update-workbook.xml:

<tsRequest>
  <workbook showTabs="true" >
      <project id="7b6b59a8-ac3c-4d1d-2e9e-0b5b4ba8a7b6" />
 </workbook>
</tsRequest>

Example response:

<?xml version="1.0" encoding="UTF-8"?>
<tsResponse version-and-namespace-settings>
  <workbook name="Finance" id="1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d"
        contentUrl="Finance" showTabs="true" >
    <project id="7b6b59a8-ac3c-4d1d-2e9e-0b5b4ba8a7b6"/>
    <owner id="9f9e9d9c-8b8a-8f8e-7d7c-7b7a6f6d6e6d"/>
  </workbook>
</tsResponse>

Tableau
1
Prakash SamariyaIT ProfessionalAuthor Commented:
Hi, I know this as it use to make round trip to restapi and does not perform action in a single trip!!

I wish if it is possible in a single trip!
0
Vikas GargBusiness Intelligence DeveloperCommented:
Hi,

What do you mean by round trip.

And if you are saying that you know the above solution you should have mentioned that you are facing the issue.

I showed you the method to update the user information which was I think the requirement.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Prakash SamariyaIT ProfessionalAuthor Commented:
I think, you did not read the questions correctly!
while creating user it does not allow us to give credentials; and we need to round trip for that!

" What do you mean by round trip." means we need to make another request(trip) to server!
0
Vikas GargBusiness Intelligence DeveloperCommented:
Hi,

Can You please post the error you are facing which will help to understand the issue in more deep ?
0
Vikas GargBusiness Intelligence DeveloperCommented:
Hi,

When You add a new user to tableau server,
first  call '/api/2.0/sites/site_id/users/' API to add a user without password and
then  call '/api/2.0/sites/site_id/users/user_id' to give a password for it.

I mean, when create a new user, you must call these two APIs?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Prakash SamariyaIT ProfessionalAuthor Commented:
I know these steps but I want to avoid that and I was looking for some workaround to provide whole bits of information including credentials while creating users!!

Anyway, Thanks Vikas for your help!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
DB Reporting Tools

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.