Deleting a Group

You can delete a group by calling the delete API:

curl -v -X DELETE \
  -H "Authorization: Bearer {ACCESS_TOKEN}" \
  "https://api.kii.com/api/apps/{APP_ID}/groups/{GROUP_ID}"

Kii Cloud will return with a 204 response if the group has been successfully deleted.

When a group is deleted, all data that belong to this group (i.e. buckets, KiiObjects, and topics) will be automatically deleted.

Considerations in deleting users

Deleting a group owner does not automatically delete groups associated with the owner even if such groups has no member. Therefore, orphan groups and data of such groups can continue to consume space on your application.

To avoid possible confusion, you should be aware of the following points.

  • When you delete a group owner

    A group will remain after you delete its owner. Since only a group owner can assign a new owner, and add and remove group members, no one will be able to manage the group.

    To avoid the deadlock, implement one of the following steps together with the step of deleting a group owner:

    • Change the group owner.
    • Reject the deletion of the group owner and prompt to assign a new group owner.
    • Delete the group with the owner.
  • When you delete the last group member

    When the last group member is deleted, there will be of course no user in the group. You can still access the group via its URI, but you will not be able to access the group if the URI is lost (For referencing a group, see Retrieving a Group and Relationship between a User and a Group).

    If your mobile app is not designed to save the group's URI, you need to carefully implement the user deletion. For example, you might want to implement the following logic:

    1. Get a list of groups that the user to be deleted is a member of.
    2. Get the members of each group on the list.
    3. When the user is deleted, delete groups whose sole member is the user.