Title: Can&#039;t get user information
Last modified: August 31, 2016

---

# Can't get user information

 *  Resolved [Goharika](https://wordpress.org/support/users/goharika/)
 * (@goharika)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cant-get-user-information/)
 * Hi all,
    I am using second version of wp api. As we can see in documentation 
   for getting users or user data we should type after url /users or users/ID. here
   is my url [http://lc13754376.on-rev.com/restapi/wp-json/wp/v2/users/](http://lc13754376.on-rev.com/restapi/wp-json/wp/v2/users/),
   But this returns only first user avatar info, But I need all users info. And 
   when I am trying to get one user info it returns me [ { “code”: “rest_user_cannot_view”,“
   message”: “Sorry, you cannot view this user”, “data”: { “status”: 403 } } ]
 * Also I want to mention I am using Basic Authentication for authentication. I 
   have add my super admin details as username and password, but I can’t see other
   users.
    Please help me to solve this.
 * [https://wordpress.org/plugins/rest-api/](https://wordpress.org/plugins/rest-api/)

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * (@danielbachhuber)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cant-get-user-information/#post-7026878)
 * WP-API only exposes user details after they’ve published one post. If they haven’t
   published a post, viewing the user requires the `list_users` capability.
 * Based on your error message, it appears to be a logged in request without sufficient
   capabilities to view the user.
 * > I have add my super admin details as username and password, but I can’t see
   > other users.
 * Does your super admin have a role on that particular site?
 *  Thread Starter [Goharika](https://wordpress.org/support/users/goharika/)
 * (@goharika)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cant-get-user-information/#post-7026884)
 * Let me explain clearly.
    I have list of users, they shouldn’t post anything, 
   they are my subscribers. So I want to get information about their role or status
   for third party app. If user status is suspended I want to stop the service. 
   So my users shouldn’t work with posts or etc. they are just member of my Membership.
   In this case please let me know am I doing right working with WP API?
 *  Plugin Author [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * (@danielbachhuber)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cant-get-user-information/#post-7026892)
 * > So I want to get information about their role or status for third party app.
   > If user status is suspended I want to stop the service. So my users shouldn’t
   > work with posts or etc. they are just member of my Membership
 * You’ll need to write some custom code to accommodate this use case, as it’s not
   something WP-API can support out of the box. WordPress’ permissions model is 
   such that a user must have published a piece of content in order for their details
   to be publicly exposed.
 * If your requests are _authorized_ and the requesting user can `edit_user` of 
   that particular user, then you should be able to manage your users (e.g. change
   their details).
 *  [webstyle](https://wordpress.org/support/users/webstyle/)
 * (@webstyle)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/cant-get-user-information/#post-7027136)
 * Why isn’t this information mentioned in the API dosc? I spent an hour to figure
   out a user should have a published post to be exposed via API.
 *  Plugin Author [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * (@danielbachhuber)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/cant-get-user-information/#post-7027137)
 * > Why isn’t this information mentioned in the API dosc?
 * Where would be the best place for it?
 *  [misterlib](https://wordpress.org/support/users/misterlib/)
 * (@misterlib)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/cant-get-user-information/#post-7027143)
 * [@goharika](https://wordpress.org/support/users/goharika/), did you figure out
   a solution for this?
 * I’m using WooCommerce subscriptions and trying to authenticate logins, but only
   getting back the admin account.
 * Hoping you (or someone else) can point me toward a solution?
 * Thanks.
 *  [rom174](https://wordpress.org/support/users/rom174/)
 * (@rom174)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/cant-get-user-information/#post-8599950)
 * UP !
    The same by my side. Even changing this:
 *     ```
       		if ( ! current_user_can( 'list_users' ) ) {
       			$prepared_args['has_published_posts'] = true;
       		}
       ```
   
 * to this :
 *     ```
       		if ( ! current_user_can( 'list_users' ) ) {
       			$prepared_args['has_published_posts'] = false;
       		}
       ```
   
 * doesn’t work.
 *  [rom174](https://wordpress.org/support/users/rom174/)
 * (@rom174)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/cant-get-user-information/#post-8599971)
    -  This reply was modified 9 years, 7 months ago by [rom174](https://wordpress.org/support/users/rom174/).
 *  [rom174](https://wordpress.org/support/users/rom174/)
 * (@rom174)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/cant-get-user-information/#post-8599981)
 * Sorry in fact this works, I just forgot to empty the cache. Doing it works perfectly
   as I have been able to even get users that never published.
 * Now I have an other question, if I don’t want to give any of my subscribers in
   order to keep privacy and to avoid brut force attack on a login name, how could
   we display no users when calling this endpoint `/wp/v2/users/`?
    Is there something
   to change here :
 *     ```
       if ( ! current_user_can( 'list_users' ) ) {
       	$prepared_args['has_published_posts'] = true;
       }
       ```
   
    -  This reply was modified 9 years, 7 months ago by [rom174](https://wordpress.org/support/users/rom174/).

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Can't get user information’ is closed to new replies.

 * ![](https://ps.w.org/rest-api/assets/icon-256x256.png?rev=1346297)
 * [WordPress REST API (Version 2)](https://wordpress.org/plugins/rest-api/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/rest-api/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/rest-api/)
 * [Active Topics](https://wordpress.org/support/plugin/rest-api/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/rest-api/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/rest-api/reviews/)

## Tags

 * [users](https://wordpress.org/support/topic-tag/users/)

 * 9 replies
 * 5 participants
 * Last reply from: [rom174](https://wordpress.org/support/users/rom174/)
 * Last activity: [9 years, 7 months ago](https://wordpress.org/support/topic/cant-get-user-information/#post-8599971)
 * Status: resolved