API - Best way to get user details by email


(Dean Taylor) #1

What is the best way to get a users username from email address via the API?

I used to use /admin/users/list/active.json?filter=john@example.com but recently a change as caused that to not return email addresses.

What is the best alternative?


How to check if a user existed or not based on email?
(Sam Saffron) #2

There should be a new API endpoint have a look in chrome dev tools.


(Dean Taylor) #3

@sam I understand Chrome Dev tools reveals the API endpoints.

The problem is that the active users search page no longer searches by email - only usernames.

What other pages allow searching via emails?

This input box used to allow emails - it doesn’t any longer.


(Sam Saffron) #4

That is a problem and an oversight @zogstrip @codinghorror we need a way for admins to search by email.


(Dean Taylor) #5

This is a big issue for me - currently my SSO sign up process is dependant on the ability to check to see if the user exists in Discourse by email address.


(Dean Taylor) #6

@sam does this need to be recategorised as a bug to avoid it being lost?


(Sam Saffron) #7

@zogstrip will be working on this tomorrow.


(RĂ©gis Hanol) #8

Sorry about that, it’s now fixed :snake:

https://github.com/discourse/discourse/commit/c46b9c0ac3ff88345b4cfdc44f3ac889e13dc597


(RĂ©gis Hanol) #9

(Sam Saffron) #10

Per:

If you are searching by email use:

SITENAME.com/admin/users/list/all.json?email=some@email.com

Using filter is inefficient and not recommended for this use case!


API Endpoint to Retrieve Community Emails Addresses
Can not use new API to get a user by email