system.mes.personnel.exportPersonnelAsJson
Description
Exports all or selected personnel as raw bytes in JSON format (UTF-8 encoded).
Streams personnel data from the database and formats it as JSON, where each object corresponds to a
PersonnelImportDTO. When idsOrPaths is omitted, all personnel are exported.
Permissions
This method requires the PERSONNEL.READ.GET permission.
Syntax
system.mes.personnel.exportPersonnelAsJson()
system.mes.personnel.exportPersonnelAsJson(idsOrPaths=["Enterprise/Site/Operators/John Doe"])
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
idsOrPaths | String[] | Yes | The ids or paths of the personnel 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.personnel.exportPersonnelAsJson()
system.perspective.download("personnel.json", jsonBytes)
Script Console
jsonBytes = system.mes.personnel.exportPersonnelAsJson()
path = system.file.saveFile("personnel.json")
if path is not None:
system.file.writeFile(path, jsonBytes)