Remove users script either via API or PG available?


(Jared Needell) #1

I’m curious if it’s possible to delete users via Postgres or API?


(cpradio) #2

API definitely, you simply have to open the Dev Tools/Console of your browser, go to the Network tab, perform the action in the browser and see what calls show up in the Network tab, that will tell you how to implement it via API.

You should be able to do it via Rails Console too


(Jared Needell) #3

I don’t see any documentation on what the API methods are to remove a user.


(cpradio) #4

The entire Discourse platform uses the API, so if you watch what the web application does, you can see what API calls to make. Which is where the Dev Tools/Console comes in play on your browser.


(Jared Needell) #5

So I’m using firefox with the Network tab open, I got the users page in the admin console, selected to open the user then clicked clear on the Network console to only monitor API calls when I click delete.

I noticed I got one GET and 2 POSTs…

http://pastebin.com/Etugzdfa


(cpradio) #6

I don’t think you caught the request, it was this one

Request URL:https://_your_discourse_instance_/admin/users/18.json
Request Method:DELETE
Status Code:200 OK

As a form data of

context=/admin/users/_your_users_userid_/_username_