Skip to main content

Fetch all groups associated to a member

You can use the Kisi API to fetch all groups associated with a member, get more information about a group, or see a list of doors belonging to a specific group.

To achieve these, first you must identify the user_id. Once you have this, you need to fetch all group level role assignments associated with this user id. Follow the steps below.

Identify the user id

Send a GET request to the Fetch members endpoint, while using the query parameter to filter by name or email. See the example below.

Example

curl --request GET \
--url 'https://api.kisi.io/members?query=user@example.com' \
--header 'Authorization: KISI-LOGIN <API_KEY>' \
--header 'Content-Type: application/json' \

Response

If your request was successful, you'll receive a 200 OK response containing the user object and, within it, the related user id.

{
"id": 0,
"name": "string",
"user": {
"id": 0,
"name": "string",
"email": "user@example.com"
}
}

Copy the id value from within the user object, since you'll need this in the next step.

Fetch all group level role assignments

Next, send a GET request to the Fetch role assignments endpoint, and filter by the user_id you obtained in the previous step. See the example below.

Example

curl --request GET \
--url 'https://api.kisi.io/role_assignments?user_id=0' \
--header 'Authorization: KISI-LOGIN <API_KEY>' \
--header 'Content-Type: application/json' \

Response

If your request was successful, you'll receive a 200 OK response containing all role assignments associated to this user_id, including those on organization and place levels. Go through the list and pick all group_id attributes.

{
"group_id": 0,
"group": {
"id": 0,
"name": "Example group name"
}
}

Get more information about a group

You can use the group_id that you obtained in the previous step to get more information about the group, like its name and permissions.

Send a GET request to the Fetch groups endpoint, while using the ids parameter to filter by group_id. See the example below.

Example

curl --request GET \
--url 'https://api.kisi.io/groups?ids=0' \
--header 'Authorization: KISI-LOGIN <API_KEY>' \
--header 'Content-Type: application/json' \

Response

If your request was successful, you'll receive a 200 OK response containing all the information about the group associated with this group_id.

[
{
"id": 0,
"name": "string",
"description": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"geofence_restriction_enabled": true,
"geofence_restriction_radius": 0,
"primary_device_restriction_enabled": true,
"reader_restriction_enabled": true,
"time_restriction_enabled": true,
"login_enabled": true,
"members_count": 0,
"locks_count": 0,
"elevator_stops_count": 0,
"place_id": 0,
"place": {
"id": 0,
"name": "string"
},
"time_restriction_time_zone": "string",
"time_restriction_time_slots": []
}
]

Get a list of doors belonging to a specific group

Once you know the group_id, you can also use this to get a list of doors belonging to the group associated with this value.

Send GET request to the Fetch group locks endpoint, while filtering by group_id, as shown below:

Example

curl --request GET \
--url 'https://api.kisi.io/group_locks?group_id=0' \
--header 'Authorization: KISI-LOGIN <API_KEY>' \
--header 'Content-Type: application/json' \

Response

If your request was successful, you'll receive a 200 OK response containing all the locks (i.e. doors) associated with this group_id.

[
{
"id": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"group_id": 0,
"group": {
"id": 0,
"name": "string"
},
"lock_id": 0,
"lock": {
"id": 0,
"name": "string",
"description": "string"
},
"place_id": 0,
"place": {
"id": 0,
"name": "string"
}
}
]