RestAPIPost gives always gives nil result?


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

function send(id, destination, SOPInstanceUID, debug)
if (debug == true) then
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)
–SendToModality(id, destination)

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.”,false)’

I get:

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

[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.


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:

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.