system.mes.inventory.operation.importFromJson
Description
Imports Inventory Operations from a JSON file provided as raw bytes. The service layer parses the JSON content and creates or updates inventory operation entities.
Recommended to export at least one pre-existing inventory operation to JSON using the exportAsJson functionality to ensure the correct format of the JSON file.
Syntax
system.mes.inventory.operation.importFromJson(importBytes)
Parameters
Parameter | Type | Nullable | Description |
---|---|---|---|
importBytes | PyArray | False | The JSON content as raw bytes. |
Returns
An ApiResponse object where data
is the number of inventory operations successfully imported or updated.
Code Examples
Here is an example of how to use the importFromJson
method in the context of a Perspective File Upload Component
onFileReceived
event handler. Reference Perspective - File Upload Scripting
for more information on the onFileReceived
event handler.
def runAction(self, event):
jsonBytes = event.file.getBytes()
system.mes.inventory.operation.importFromJson(jsonBytes)