Skip to main content

getRootUserGroups

Get all top-level user groups.

Description​

Fetches the top-level user groups, the ones without a parent. Resolves to an array of IUserGroupEntity objects.

.getRootUserGroups(

);

Parameters schema​

Schema

langCode: string
Language code. Default: the langCode passed to defineOneEntry ("en_US" if none).
example: "en_US"

Examples​

Minimal example​

const response = await UserGroups.getRootUserGroups();

Example response​

[
{
"id": 1,
"depth": 0,
"parentId": null,
"localizeInfos": {
"title": "Guest"
},
"isVisible": true,
"childrenCount": "0",
"identifier": "guest",
"isSync": false,
"attributeValues": {}
},
{
"id": 2,
"depth": 0,
"parentId": null,
"localizeInfos": {
"title": "sd"
},
"isVisible": true,
"childrenCount": "0",
"identifier": "wewe",
"isSync": false,
"attributeValues": {}
}
]

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.