Is there a way for External Plugin getting result from the job ?

Hi Author,
I am developing a Plugin which is able to retrieve the whole Study in JPEG format. Since the process is quite heavily so I am using asynchronous Job. I already created a Job which processes and outputs to ZIP file. But I dont know how to retrieve that ZIP file from the Job ID. What I want to do is similar to excerpt from

$ curl http://localhost:8042/studies/27f7126f-4f66fb14-03f4081b-f9341db2-53925988/archive -d ‘{“Asynchronous”:true}’ { “ID” : “82cc02d1-03fe-41f9-be46-a308d16ea94a”, “Path” : “/jobs/82cc02d1-03fe-41f9-be46-a308d16ea94a” } $ curl http://localhost:8042/jobs/82cc02d1-03fe-41f9-be46-a308d16ea94a { “CompletionTime” : “20200817T144700.401777”, “Content” : { “Description” : “REST API”, “InstancesCount” : 232, “UncompressedSizeMB” : 64 }, “CreationTime” : “20200817T144658.011824”, “EffectiveRuntime” : 2.3879999999999999, “ErrorCode” : 0, “ErrorDescription” : “Success”, “ID” : “82cc02d1-03fe-41f9-be46-a308d16ea94a”, “Priority” : 0, “Progress” : 100, “State” : “Success”, “Timestamp” : “20200817T144705.770825”, “Type” : “Archive” } $ curl http://localhost:8042/jobs/82cc02d1-03fe-41f9-be46-a308d16ea94a/archive >

“”"Note how we retrieve the content of the archive by accessing the archive output of the job (check out the virtual method IJob::GetOutput() from the source code of Orthanc).

As of Orthanc 1.7.4, only the creation of a ZIP or a DICOMDIR archive produces such an “output”.“”"

Seems like Orthanc has not yet developed feature of getting output in file PluginsJob.h

virtual bool GetOutput(std::string& output,
MimeType& mime,
const std::string& key) ORTHANC_OVERRIDE
return false;

Is there another to sort it out ? Or should we use Synchronous mode instead ?


You are right: As of Orthanc 1.7.4, it is not possible for a user-defined job to return an output. I have just added a TODO:

In the meantime, you can implement such a feature by manually adding a separate route in the REST API using “OrthancPluginRegisterRestCallback()” that would implement HTTP GET (taking as an input the job ID in the URL), and that would give access to the output of your job.