get Box users on box-sdk doesn't brings all the users

Highlighted
Occasional Contributor

get Box users on box-sdk doesn't brings all the users

Hi all, and thanks for helping,

In our product, we connecting to Box's service accounts (Box's customers) and scan their accounts.
We have an issue that the Box get users API not returning all the users.

 

At the beginning, we used at box-sdk version 2.24.0 and uses the method:

 

BoxUser.getAppUsersByExternalAppUserID(<BoxDeveloperEditionAPIConnection>, null, <fields>); 

 


The method returned 1000 users out of 30,000. I read and saw that there is a new method with pagination,

 

BoxUser.getAppUsersByExternalAppUserID(BoxDeveloperEditionAPIConnection, null, true, marker, <fields>);

 


I upgraded the box-sdk to 2.44.1 version and uses the method as follows

 

 

public Iterable<BoxUser.Info> getUsers(String marker) {
//BoxDeveloperEditionAPIConnection is and object, it is just an example to the object type
  return BoxUser.getAppUsersByExternalAppUserID(BoxDeveloperEditionAPIConnection, null, true, marker, "login", "role", "");
}


public Iterator<String> getUsersLogins() {
  log.info("try to get users login");
  Iterator<BoxUser.Info> users = getUsers(null).iterator();
  log.info("took users login");
  return new Iterator<String>() {

    private Iterator<BoxUser.Info> localUsers = users;
    @Override
    public boolean hasNext() {
      try {
        boolean hasNext = localUsers.hasNext();
        if (hasNext == false) {
          String marker = ((BoxResourceIterable<BoxUser.Info>) 
            localUsers).getNextMarker();
          if (marker != null) {
            log.info("getting the next marker " + marker);
            localUsers = getUsers(marker).iterator();
            return localUsers.hasNext();
          }
        }
        return hasNext;
        } catch (Exception e) {
          log.error("has next in box users failed, {}", e.getMessage());
        }
        return false;
       }

       @Override
       public String next() {
         BoxUser.Info user = localUsers.next();
         return user == null ? null : user.getLogin();
       }
      };

}

 

 

Later this change, I am getting only ~27,000 users out of ~30,000 users.
It is not clear where is the rest 3,000 users. it is very urgent to me because my customer must data from the disappear's users.

The customer succeeds to connect to the disappear's users directly.

Please assist it is very urgent to me

 

1 REPLY 1
Highlighted
Box Employee

Re: get Box users on box-sdk doesn't brings all the users

Hi @bigid 

Were you able to get the answer to this question? 

Where are you seeing the count of 30k users? There may be a data mismatch issue unrelated to the SDK.