Assign role to group
Assign role to group
client.zones.groups.roles.add(stringgroupID, RoleAddParams { zoneId, owner_type, role_id, 3 more } params, RequestOptionsoptions?): RoleAssignment { id, created_at, principal_id, 8 more }
POST/zones/{zoneId}/groups/{groupId}/roles
Assigns a role to the group; members inherit it. Provide role_id, or role_identifier with owner_type. Returns the shared role-assignment shape with principal_type set to group.
Parameters
groupID: string
Returns
Assign role to group
import KeycardAPI from '@keycardai/api';
const client = new KeycardAPI({
apiKey: process.env['KEYCARD_API_API_KEY'], // This is the default and can be omitted
});
const roleAssignment = await client.zones.groups.roles.add('groupId', { zoneId: 'zoneId' });
console.log(roleAssignment.id);{
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"principal_id": "principal_id",
"principal_type": "principal_type",
"role_id": "role_id",
"role_identifier": "role_identifier",
"role_owner_type": "platform",
"updated_at": "2019-12-27T18:11:19.117Z",
"zone_id": "zone_id",
"scope_id": "scope_id",
"scope_type": "scope_type"
}Returns Examples
{
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"principal_id": "principal_id",
"principal_type": "principal_type",
"role_id": "role_id",
"role_identifier": "role_identifier",
"role_owner_type": "platform",
"updated_at": "2019-12-27T18:11:19.117Z",
"zone_id": "zone_id",
"scope_id": "scope_id",
"scope_type": "scope_type"
}