system.mes.role.exportRolesAsJson
Description
Exports all or selected roles as raw bytes in JSON format (UTF-8 encoded).
Streams role data from the database and formats it as JSON, where each object corresponds to a
RoleImportDTO. When ids is omitted, all roles are exported.
Permissions
This method requires the SYSTEM.ADMIN permission.
Syntax
system.mes.role.exportRolesAsJson()
system.mes.role.exportRolesAsJson(ids=["01J9YP3JBR-WQ8GWRR2-8Y879V2D"])
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
ids | String[] | Yes | The ids of the roles to export. Omit to export all. |
Returns
A byte array (byte[]) containing the raw byte data of the JSON export (UTF-8 encoded).
Code Examples
Perspective
jsonBytes = system.mes.role.exportRolesAsJson()
system.perspective.download("roles.json", jsonBytes)
Script Console
jsonBytes = system.mes.role.exportRolesAsJson()
path = system.file.saveFile("roles.json")
if path is not None:
system.file.writeFile(path, jsonBytes)