dm.linov
(Dmitry)
17 בפברואר, 2020, 7:13pm
1
We are creating users and topics via API. We need to check if a user with such email had been created before. If yes, then we create a topic from the existing user.
So I need an API call “get username by email, if any”. How can I do that? I only found the reverse one.
There’s a link mentioned in several topics, that might have the answer, but it’s broken.
https://meta.discourse.org/t/api-best-way-to-get-user-details-by-email/20806/10
2 לייקים
That is a bit of a privacy violation so don’t expect it to be easy.
dm.linov
(Dmitry)
17 בפברואר, 2020, 7:58pm
3
Why? The admin of the forum can see search user by email via the web interface, what’s the difference if he does the same via API?
Sure if you use an admin api key that should work.
dm.linov
(Dmitry)
17 בפברואר, 2020, 8:01pm
5
That’s exactly my question. There’s a “Get a single user by username” call in the API docs, but how do I get a single user by email?
לייק 1
Follow the method here since you are an admin and know how to look users up by email address, yes?
Discourse is backed by a complete JSON api. Anything you can do on the site you can also do using the JSON api.
Many of the endpoints are properly documented in the discourse_api gem, however some endpoints lack documentation.
To determine how to do something with the JSON API here are some steps you can follow.
Example: recategorize a topic.
Go to a topic and start editing a category:
[image]
Open Chrome dev tools, switch to the Network tab, select XHR filter:
[image]
Perform the op…
3 לייקים
dm.linov
(Dmitry)
17 בפברואר, 2020, 8:14pm
7
Got it, thank you!
Posting it here for anyone else who might need it.
[discourse_url]/admin/users/list/active.json?filter=[email_name]%40[email_domain]&show_emails=false&order=&ascending=&page=1
11 לייקים
system
(system)
נסגר ב־
18 במרץ, 2020, 8:14pm
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.