RestAPIPost gives always gives nil result?

Hello,

I can’t reproduce your issue. If I load your Lua script:

function send(id, destination, SOPInstanceUID, debug)
if (debug == true) then
return
end
print(‘SOPInstanceUID’, SOPInstanceUID)
– Send the modified instance to another modality
local url = ‘/modalities/’ … destination …‘/store’
local results = RestApiPost(‘/modalities/’ … destination …‘/store’, id)
print('RestApiPost results for: ’ … url)
print(results)
PrintRecursive(ParseJson(results))
–SendToModality(id, destination)
end

Using the following Orthanc configuration:

{
“LuaScripts” : [ “test.lua” ],
“DicomModalities” : {
“storescp” : [ “STORESCP”, “localhost”, 2000 ]
}
}

And if I type the following command line:

curl -X POST http://localhost:8042/tools/execute-script -d ‘send(“19816330-cb02e1cf-df3a8fe8-bf510623-ccefe9f5”,“storescp”,“1.2.840.113543.6.6.4.7.64234348190163144631511103849051737563212”,false)’

I get:

SOPInstanceUID, 1.2.840.113543.6.6.4.7.64234348190163144631511103849051737563212
RestApiPost results for: /modalities/storescp/store
{
“Description” : “REST API”,
“FailedInstancesCount” : 0,
“InstancesCount” : 1,
“LocalAet” : “ORTHANC”,
“RemoteAet” : “STORESCP”
}

table
[FailedInstancesCount], number, 0
[LocalAet], string, ORTHANC
[InstancesCount], number, 1
[Description], string, REST API
[RemoteAet], string, STORESCP

Which indicates that everything works as expected: There is no problem related to a “nil” result.

Sébastien-

The “osimis/orthanc:17.6.1” image is very outdated: It features Orthanc 1.2.0 (released on December 2016), whereas the current release is 1.4.2. Please upgrade:
https://osimis.atlassian.net/wiki/spaces/OKB/pages/26738689/How+to+use+osimis+orthanc+Docker+images

Note that I copied/pasted the result from the Orthanc mainline (i.e. in-development version). Orthanc 1.4.2 will only return an empty JSON object after POST-ing on URI “/modalities/…/store”: The fields “InstancesCount” and “FailedInstancesCount” will only be provided in forthcoming Orthanc 1.4.3.