Retrieving user information via REST API


I have been looking for some specific user data. The users flagged data:

  • number_of_flagged_posts
  • number_of_suspensions
  • warnings_received_count

I found that this information is part of the user class

but is not part of the ‘user’ that the REST API returns{tag}%2Fget{flag}.json%2Fget

I am wondering how I can get the user’s

  • number_of_flagged_posts
  • number_of_suspensions
  • warnings_received_count

through the REST API. And if it’s not possible, then is a plugin REST API that surfaces this information the enxt best option?

1 Like

Apparently the admin user route isn’t documented in the API Docs. I’ll make sure that route is added.

If you GET /admin/users/{id}.json it will return these fields which are close to what you are after:

suspended (boolean)

I would start with the Data Explorer Plugin where you can create a saved query that you can send an API call to and pass it a user id to return exactly what you are after. But yes, creating a plugin that creates a new route to expose those fields is also an option.


AHH THANK YOU! This is what I was looking for! You’re awesome :slight_smile:


I just added the GET /admin/users/{id}.json route to the api docs.


To add to this, I also noticed that the silence endpoint isn’t visible in the API docs as well. I found it by taking a guess :stuck_out_tongue:

PUT /admin/users/{id}/silence


Hmm I have also noticed a few differences between the two endpoints (in case @blake you were going to add the silence user to the API docs)

suspend silence differences
PUT /admin/users/{id}/suspend PUT /admin/users/{id}/silence endpoints
suspend_until silenced_till request body
Yes No Update while silenced /suspended

The last column in the table is causing me some trouble at the moment. I am trying to silence a user programmatically, but if they have already been silenced before, and I make a new silencing request with a later silenced_till date the date doesn’t get updated.

Almost as if the endpoint is saying “do nothing if the user is already silenced”

The suspend endpoint doesn’t behave like this. Rather it updates the suspend_until time.

Any advice?


It is. You can see where it happens here:

It’s possible to update the silenced_till parameter directly on the user, but there’s no API endpoint for that, so doing it that way would require a plugin.