aahoughton
(Andrew Houghton)
24 يوليو 2020، 4:20م
1
'lo. We’re using hosted discourse with OAuth. We suddenly realized that when we process deletions, we’re neglecting to delete from our discourse instance.
I’d like to be able to anonymize an account, OR delete an account programmatically using the API – but I don’t see an easy way to do that, given that I don’t know what the discourse account ID is.
Am I missing something obvious? Any suggestions?
Thanks,
Andrew
4 إعجابات
simon
24 يوليو 2020، 5:21م
2
Do you know if email addresses match between your OAuth identity provider and Discourse? If they do, you could get the Discourse user based on their email address by making an authenticated API request to /admin/users/list/all.json?email=<users_email_address>
. For example:
curl -X GET "http://localhost:3000/admin/users/list/all.json?email=bob@example.com" \
-H "Api-Key: $api_key" \
-H "Api-Username: system"
5 إعجابات
aahoughton
(Andrew Houghton)
24 يوليو 2020، 5:25م
3
They should match, thank you – that was the call I was missing. Verifying.
jezra
(jezra)
26 أبريل 2021، 7:35م
4
I am also interested in using an api call to anonymize a user. What is the API endpoint you are using to anonymize a user?
weallwegot
(juicecounty.prodigy)
27 أبريل 2021، 2:20ص
5
The API endpoint for anonymizing:
HTTP Method: PUT
Endpoint: https://example-community.dev/admin/users/{id}/anonymize
Hi folks, I’m trying to hit the endpoint to anonymize a user in Discourse; I’ve got single sign-on between WordPress and Discourse set up, and when the user deletes their account on WordPress I want to anonymize them in Discourse. The endpoint is
/admin/users/{id}/anonymize:
put:
description: |
Anonymize a user
tags:
- Admin
parameters:
- name: id
in: path
required: true
type: integer
responses:
'200':
description: succesfully anonymized user
…
you can use the call shown above to get the {id}
value if you already know the email of the user you want to anonymize
7 إعجابات
Was the /anonymize
endpoint removed form the API docs?
I was looking here:
https://docs.discourse.org/#tag/Admin/paths/~1admin~1users~1{id}.json/get
Under users
as well as admin
.
إعجابَين (2)
blake
(Blake Erickson)
28 يوليو 2021، 1:03ص
7
It might not have been added to the api docs yet, I’ll make sure it gets documented soon.
3 إعجابات
blake
(Blake Erickson)
29 يوليو 2021، 11:53م
8
@sarahann the /anonymize
route has been added to the api docs.
3 إعجابات
Phew! Scared me for a sec
Thanks for the speedy turnaround on this!
إعجاب واحد (1)