Suspend a user via the API

api
rewrite-pending
starter-task

(Sylvain Kalache) #1

I spent quite some time to figure this out so I thought I’ll share it for the next person who want to do this: suspend a user via the API.

If you use Discourse web interface, you can go to the route /admin/users/:username and then use the suspend button. You can find the suspend method in UsersController. Well turns out that you should not use :username in the route but the user_id.

To conclude, to disable a user via the API, use /admin/users/:user_id/suspend


Suspending an expired user
(Kenny Meyer) #2

Also, more details in the current API documentation: Discourse API Docs


(Erlend Sogge Heggen) #3

I think a good v2 for this article would be a “Common API operations” article that incorporates several of the usual suspects.

We’d be willing to pay for this rewrite so please send me a PM if you’re interested.