Skip to main content
Version: V2 (Ignition 8.1)

system.mes.util.backup

Description

Exports entities in JSON format and returns the result as a zipped file of raw bytes.

When no entities are provided, all entities are backed up. When the entities argument is provided, only the named entity types are backed up.

The returned bytes can be written to a file and later imported with restore.

Permissions

This method requires the SYSTEM.ADMIN permission.

Syntax

system.mes.util.backup()
system.mes.util.backup(entities)

Parameters

All Entities:

ParameterTypeNullableDescription
None--This method does not take any parameters.

Selected Entities:

ParameterTypeNullableDescription
entitiesString[]TrueThe list of entity types to back up. Omit to back up all entities.

Returns

The zipped backup as a byte[] (raw bytes).

Code Examples

import system.file

# Back up all entities
allBytes = system.mes.util.backup()
system.file.writeFile("C:/path/to/backup.zip", allBytes)

# Back up only the selected entity types
selectedBytes = system.mes.util.backup(entities=["location", "material"])
system.file.writeFile("C:/path/to/backup-selected.zip", selectedBytes)