getUserGroupById
Get a single user group by its ID.
Description
Fetches a user group by its numeric ID and resolves to an IUserGroupEntity. If no group has that ID, it resolves to an IError with statusCode: 404 ("Group not found").
.getUserGroupById(
,
);
Parameters schema
Schema
id(required): number
User group ID.
example: 1
langCode: string
Language code. Default: the langCode passed to defineOneEntry ("en_US" if none).
example: "en_US"
Examples
Minimal example
const response = await UserGroups.getUserGroupById(1);
Example response
{
"id": 1,
"depth": 0,
"parentId": null,
"localizeInfos": {
"title": "Guest"
},
"isVisible": true,
"childrenCount": "0",
"identifier": "guest",
"isSync": false,
"attributeValues": {},
"version": 0
}
Response schema
Schema: IUserGroupEntity
id: number
User group ID.
example: 1
depth: number
Level of the group in the tree: 0 for a top-level group, the parent's depth plus 1 for a child.
example: 0
parentId: number | null
Identifier of the parent group, null for a top-level group.
example: null
localizeInfos: ILocalizeInfo
Localized title of the group.
isVisible: boolean
Whether the group is visible.
example: true
childrenCount: string
Number of child groups. The API sends it as a string, not a number.
example: "0"
identifier: string
Text identifier (marker) of the group.
example: "guest"
isSync: boolean
Whether the group's attribute index is built for the requested language. When false, an empty attributeValues means the values aren't indexed yet, not that there are none.
example: false
attributeValues: IAttributeValues
Attribute values of the group.
version: number
Version number of the group. Returned only by getUserGroupById() and getUserGroupByMarker(); the list methods (getUserGroups(), getRootUserGroups(), getChildUserGroupsByMarker()) omit it.