box-java-sdk - getAllEnterpriseUsers() not respecting filter_term
I set up a basic Box app based on the Build On Box Platform tutorial. I then created a small Java application utilizing the Java SDK which creates a couple of AppUser accounts. My goal is to log in as the AppUser based on the name that I provided to the create user process instead of the generated UserId. I did not see a method for this so I took the approach using getAllEnterpriseUsers() to search for the user account and get its ID.
The issue that I am encountering is that when I attempt to filter the users based on the name, getAllEnterpriseusers() returns the full set of AppUsers. I can put junk text in the filter_term value, but it still returns every AppUser. It does, however, respect the fields parameter. I took the URL that is being generated by the Java SDK and put it in Postman and had the same result. For the Authorization header I used the token returned by BoxDeveloperEditionAPIConnection.getAccessToken() which uses the client Id and client secret.
https://api.box.com/2.0/users?filter_term=brian12&fields=id%2Cname%2Clogin
I then went to the Box doc site ( https://docs.box.com/reference#get-all-users-in-an-enterprise ) and tried the same query embeded in the web page and it worked. I took the token generated through the Box doc site and put that in Postman and the query then worked there as well.
Why does the users endpoint filter users when using my own credentials, but ignore the filter parameter when using the app credentials? Is there an easier way to get the user Id for a name?
Please sign in to leave a comment.
Comments
0 comments