Skip to main content

system.mes.equipment.exportAsJson

Description

Exports Equipment records as a JSON string (UTF-8 encoded). When called without arguments, exports all equipment records. When called with a list of IDs or paths, exports only the specified records.

Permissions

This method requires the EQUIPMENT.READ.GET permission.

Syntax

system.mes.equipment.exportAsJson()
system.mes.equipment.exportAsJson(idsOrPaths)

Parameters

Method 1: No Parameters

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

Method 2: With IDs or Paths

ParameterTypeNullableDescription
idsOrPathsString[]FalseAn array of equipment IDs or paths to export.

Returns

Returns all matching equipment records as a JSON string (UTF-8 encoded).

Code Examples

Perspective

jsonString = system.mes.equipment.exportAsJson()
system.perspective.download("equipment.json", jsonString)

Script Console

jsonString = system.mes.equipment.exportAsJson()
path = system.file.saveFile("equipment.json")
if path is not None:
system.file.writeFile(path, jsonString)