tableau / rest-api-samples

Samples for the Tableau REST API
MIT License
378 stars 268 forks source link

How to create user id over 100 number with using REST API in Tableau Server #59

Closed icoplandi closed 3 years ago

icoplandi commented 3 years ago

Hi

I am going to create user id over 8000 number with using REST API in Tableau Server

I wrote below code in Demo.java

UserType tmpuser = null ; for(int iii=0 ; iii < 1000; iii++)     tmpuser = s_restApiUtils.invokeCreateUser(credential, currentSiteId, "CreateUserInTableauExampleII" + Integer.toString(iii));

and I wrote below code in RestApiUtils.java

private enum Operation {  ...     CREATE_USER(getApiUriBuilder().path("sites/{siteId}/users"));

public UserType invokeCreateUser(TableauCredentialsType credential, String sitedId, String userName) {     String url = Operation.CREATE_USER.getUrl(sitedId);     TsRequest payload = createPayloadForCreatingUser(userName);     TsResponse response = post(url, creditial.getToken(), payload);     if (response.getUser() != null {         return response.getUser();     }     return null; }

I wrote adding this code "User.setSiteRole(SiteRoleType.fromValue("viewer"));" in CreatePayloadForCreatingUser() function.

I received a normal reply from Tableau server. but when I called invokeQueryUsers function, I didn't see user id  that I had created from the reply.

Why can't I create more than 100 user IDs?

icoplandi commented 3 years ago

I've noticed that Tableau Server is already creating over 10,000 user IDs. But I just found out that the reason so far only 100 user ids have been answered for every response so far, when I use invokequeryusers() within a Java program, it only responds 100 user ids at a time.