API find email address, or search?

I’ve read a discourse post, thinking I had found it " SITENAME.com/admin/users/list/all.json?email=some@email.com which is what I need, that is verify if our SSO site has a Discourse member, via query of the Discourse API (from our API) but how, as the link above doesn’t work and if I could simply get a list of all users I’d implement the filter/result based on email address.

I think this is very protected or non-accessable, or is there a way?

That route should still work (just tested it).

For SSO you could also use by-external.
See Discourse API Docs

3 Likes

@RGJ you are right! It does work!!! Something with my Postman requests tests are broken. :frowning:

However with SuperAgent request such as:

let res = await superagent.get(`${this.baseUrl}/admin/users/list/active`)
          .query({show_emails: true})
          .set('Api-Key', this.apiKey)
          .set('Api-Username', this.defaultDiscourseUser)
          .set('Content-Type', 'application/json')
          .set('Accept', 'application/json')

I was able to get the emails.

My apologies, however it would be nice to have an API request that simply returns true/false if an email exists, for now I’m pulling all users (a response that is a little heavy since it returns all user info) while all I want is to verify if the email exists - in fact I just want a true/false from Discourse if the user has logged in there first before coming to our site.

With

superagent.get(`${this.baseUrl}/admin/users/list/all.json?email=${emailAddress}`)

you’re not pulling all the users.

3 Likes

Oh wow, thanks for that! This will get only one user and email? Works for me! Great!!!

2 Likes