Hi,
I want to retrieve a search from a remote modality.
I am using curl but when I do the retrieve POST, curl keeps waiting for the full retrieve to finish which sometimes takes minutes.
How can I send an asynchronous retrieve?
Thanks
Diego
Hi,
I want to retrieve a search from a remote modality.
I am using curl but when I do the retrieve POST, curl keeps waiting for the full retrieve to finish which sometimes takes minutes.
How can I send an asynchronous retrieve?
Thanks
Diego
Hello,
There’s a “Synchronous” option that can be set to “false” if you don’t want to wait for the completion of the job.
Here’s a sample session:
$ curl http://localhost:8042/modalities/self/query -d ‘{“Level”:“Study”,“Query”:{“PatientName”:“KNEE”}}’
{
“ID” : “b37c1e11-e63d-46fe-890c-d4842eb464ca”,
“Path” : “/queries/b37c1e11-e63d-46fe-890c-d4842eb464ca”
}
$ curl http://localhost:8042/queries/b37c1e11-e63d-46fe-890c-d4842eb464ca/retrieve -d ‘{“TargetAet”:“ORTHANC”,“Synchronous”:false}’
{
“ID” : “11541b16-e368-41cf-a8e9-3acf4061d238”,
“Path” : “/jobs/11541b16-e368-41cf-a8e9-3acf4061d238”
}
HTH,
Sébastien-
Thanks. That’s exactly what I was looking for. Is it documented anywhere? I couldn’t find it.
Best
Diego
Hi Sebastien,
I tried to run the request using python-request with the following command:
u = ‘http://localhost:8042/queries/‘+q+’/retrieve’
action_item = requests.post(u,
auth=(‘XXX’, ‘XXX’),
data = “mydcmserver”)
and it works perfectly.
But when I added the Synchronous option, it responds with status 200 but no job is actually executed.
action_item = requests.post(u,
auth=(‘XXX’, ‘XXX’),
data = {“TargetAet”:“mydcmserver”,“Synchronous”:False})
Thanks
Diego
Hello,
This feature is not documented yet. Feel free to contribute by improving the following section of the documentation:
http://book.orthanc-server.com/users/rest.html#performing-retrieve-c-move
http://book.orthanc-server.com/contributing.html
Regards,
Sébastien-
Hello again,
You can monitor the completion of the submitted jobs by watching the “/jobs” URI that is returned by the call to “/queries/…/retrieve”.
The Orthanc Explorer Web interface has also a “Jobs” tab that shows the status of the jobs.
You can find examples of scripts watching for jobs in the integration tests. Check out function “MonitorJob()” in the following file:
https://bitbucket.org/sjodogne/orthanc-tests/src/default/Tests/Tests.py
Sébastien-