Get user id from email address

Highlighted
Occasional Contributor

Get user id from email address

Hello,

i have fully functional application with oauth 2.0 authentication and i need to add one more option. Automatically invite user to newly created folder. My question is, how can i get user id from email address, which i want to invite to folder. I know folder ID, but i don't know how can i get user id from email address string. It's possible to do this via API?

 

Thank you.

6 REPLIES 6
Highlighted
Box Employee

Re: Get user id from email address

HI @BAILANDO, I am not sure you actually need to. When you create a collaboration (adding a user to a folder) you can actually do so by email address (aka login in Box terms).

 

https://developer.box.com/reference/post-collaborations#param-accessible_by-login


---
Developer Advocate @ Box
Highlighted
Occasional Contributor

Re: Get user id from email address

Hello,

sorry for late response, i was on vacation.

 

With this question i mean, if it's possible via API get userid from email address.

 

For example, in RPA automation process user know email address ***email address removed for privacy*** and api return userid from this address. If i get user id then i can continue with process and creating invitation for user to specific folders.

Highlighted
Box Employee

Re: Get user id from email address

Hi @BAILANDO , yes you can. 

 

You can search for a user by login (email adress) using this API https://developer.box.com/reference/get-users/

 

Just set the filter_term to the email address of the user, and the results will be a list of 0 or 1 users who match that email address.

 


---
Developer Advocate @ Box
Highlighted
First-time Contributor

Re: Get user id from email address

I use the Box CLI to do this, pretty easy like this:

 

box users --filter=$email
Highlighted
Occasional Contributor

Re: Get user id from email address

thank you all for help

Tags (1)
Highlighted
Occasional Contributor

Re: Get user id from email address

Hello again, my last question. What scopes i need in my app to succesfully get list of enterprise users? i have application scope and manage users scope in standard oauth 2.0, but in our enviroment im not an admin. It's a problem?

 

Thank you.