system.mes.shift.exportAsJson
Description
Exports all or selected shifts as raw bytes in JSON format (UTF-8 encoded).
Streams shift data from the database and formats it as JSON, where each object corresponds to a
ShiftImportDTO. When locationIdsOrPaths is omitted, all shifts are exported.
Permissions
This method requires the SHIFT.READ.GET permission.
Syntax
system.mes.shift.exportAsJson()
system.mes.shift.exportAsJson(locationIdsOrPaths=["Enterprise/Site/Line1"])
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
locationIdsOrPaths | String[] | Yes | The location ids or paths to filter shifts by. Omit to export all shifts. |
Returns
A byte array (byte[]) containing the raw byte data of the JSON export (UTF-8 encoded).
Code Examples
Perspective
jsonBytes = system.mes.shift.exportAsJson()
system.perspective.download("shifts.json", jsonBytes)
Script Console
jsonBytes = system.mes.shift.exportAsJson()
path = system.file.saveFile("shifts.json")
if path is not None:
system.file.writeFile(path, jsonBytes)