Get User IDs using CLI

SOLVED
Go to solution
Highlighted
Occasional Contributor

Get User IDs using CLI

So I have set up the CLI and working with no issues.

However most commands require a user's ID. Yes I can get this using the admin console for individual users but that is not a practical solution for hundreds. And for some reason the Managed users report does not include this vital piece of information.

So, can I get a users ID using the CLI from their email address?

Or any other way to dump a list of all users with their ID, then I could use a CSV?

 

Thanks

3 REPLIES 3
Highlighted
Box Employee

Re: Get User IDs using CLI

Hi @hsclater , hope you're doing well and welcome to the forum. Glad to see you're getting started with the CLI!

 

To return a user ID from their email address (or even name), the argument you want to supply is --filter.

 

$ box users --filter reba --fields id
----- User 700684617 -----
Type: user
ID: '700684617'

 For reference, the full description of this filter is:

 

Search term to filter users on; matches prefixes of user name and login fields

 

From https://github.com/box/boxcli/blob/master/docs/users.md

 

Hope that helps!

Highlighted
Occasional Contributor

Re: Get User IDs using CLI

Thanks Jason

Highlighted
New Contributor

Re: Get User IDs using CLI

@Jason62, please include this in the CLI documentation as an example for box users:get [ID].

 

I would of had no way of knowing this without searching. In fact the CLI documentation needs be overhauled. It's one of the most unfriendly documentation for users. Even searching for filter help doesn't show this.