Disabling Users

You can disable users via REST API. Disabled users will not be able to log in, reset his/her password, or verify his/her account. All tokens issued to this user will be also invalidated.

Use the property "disabled" to toggle a user; setting the property value "true" will disable the user. Setting the value to "false" will enable the user again.

Here is an example of disabling a user. This call requires an admin token. Please refer Admin Features to learn how to get the admin token.

curl -v -X PUT \
  -H "Authorization: Bearer {APP_ADMIN_TOKEN}" \
  -H "Content-Type: application/vnd.kii.UserStatusUpdateRequest+json" \
  "https://api.kii.com/api/apps/{APP_ID}/users/{USER_ID}/status" \
  -d '{"disabled": true}'

Kii Cloud is respond as follow if the user is successfully disabled.

HTTP/1.1 204 No Content
Server: Apache-Coyote/1.1
Date: Mon, 14 May 2012 18:41:45 GMT

Please note that even if users are disabled, they will be found by some features like "finding other users (e.g. KiiUser.findUserByUserName method in Android SDK)" and "listing all group members". If you want to hide the disabled users, you need to implement your application accordingly, like checking the user attribute "disabled" and hide all users having the attribute value false.