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(, null, );
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, );
I upgraded the box-sdk to 2.44.1 version and uses the method as follows
public Iterable 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 getUsersLogins() {
log.info("try to get users login");
Iterator users = getUsers(null).iterator();
log.info("took users login");
return new Iterator() {
private Iterator localUsers = users;
@Override
public boolean hasNext() {
try {
boolean hasNext = localUsers.hasNext();
if (hasNext == false) {
String marker = ((BoxResourceIterable)
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件のコメント