Skip to main content

system.mes.equipment.importFromJson

Description

Imports Equipment records from a JSON file provided as raw bytes.

Recommended to export at least one pre-existing equipment record to JSON using the exportAsJson functionality to ensure the correct format.

Permissions

This method requires the EQUIPMENT.WRITE.SAVE permission.

Syntax

system.mes.equipment.importFromJson(bytes)

Parameters

ParameterTypeNullableDescription
bytesPyArrayFalseThe JSON content as raw bytes.

Returns

Returns an ApiResponse containing import result details.

NameTypeDescription
successBooleanIndicates if the import was successful.
messageStringA summary of the import result.
dataStringDetails about the imported records.
errorStringAny errors encountered during import.

Code Examples

def runAction(self, event):
jsonBytes = event.file.getBytes()
system.mes.equipment.importFromJson(jsonBytes)