auto-routing lua script

Hi,
I wrote this lua script for dicom-tag base routing,

json = require “json”

function OnStoredInstance(instanceId, tags, metadata)
– Extract the value of the “RemoteAET” DICOM tag
local RemoteAET = metadata[‘RemoteAET’]

if string.find(RemoteAET, ‘WKS1’) ~= nil then
local data= json.encode(‘{"Resources" : ["’…instanceId…‘"],"Synchronous" : false,"LocalAet" : "’…RemoteAET…‘","MoveOriginatorAet": "ORTHANC","MoveOriginatorID": 1234,"Timeout": 10,"StorageCommitment": false}’)
os.execute('curl -X POST http://localhost:8012/modalities/chntorh/store -d '…data)
end
end

but issue is when i upload this file within orthanc server, it shows error.
However, this script(json base) run perfectly out-side(commandline) on orthanc,

Please suggest. lua.PNG

lua.PNG

You must install the “json” module for Lua:
https://book.orthanc-server.com/users/lua.html#using-external-modules

This process entirely depends on your operating system. On Debian/Ubuntu, it consists in installing the package “lua-json”.

Thank you Sébastien

I found solution and resloved this.