How to get jobId during asynchronous call for study modification

Hi,

I want to modify (duplicate) study by calling this:
URL: http://localhost:8044/studies/12345678-7c64f1af-29dfb45b-c05b0413-8ff31dd9/modify
BODY: {“Asynchronous”: true}
According to the rules for asynchronous call I would expect to get response immediately with jobId as part of the response so that I can monitor related job. Still, I am receiving 200 after job is completely finished.

What I am doing wrong? How to get current jobId as part of the response during study modification?

Thanks,
Vedran

Now I see that parameter - “Asynchronous”: true - is not on list of the parameters of the study modification, so, it seems it is not supported yet. I thought that asynchronous calls are supported for study modification because I saw it here in a chapter related to the synchronous vs asynchronous calls: https://book.orthanc-server.com/users/advanced-rest.html?highlight=jobs#id5 but it seems it is possible to call it only synchronous for now even we can see in the Orthanc console that job is created during that action…

Hi Vedran,

I think that the parameter in the request body of the post is “Synchronous” and you can set it to false if you want to get back a job number that you can poll or leave to run until it finishes.

https://api.orthanc-server.com/#tag/Modification/paths/~1instances~1{Id}~1modify/post

If this is incorrect, please let me know and I’ll update the OpenAPI docs.

Cheers,
Chris

Sorry, I linked to the modify instances endpoint. Here is the modify study endpoint documentation:

https://api.orthanc-server.com/#tag/Modification/paths/~1studies~1{Id}~1modify/post

Hi,

There is following sentence in the Orthanc Book (https://book.orthanc-server.com/users/advanced-rest.html?highlight=jobs#id5):

The choice between synchronous and asynchronous modes is done by setting the Synchronous field (or indifferently the Asynchronous field) in the POST body of the call to the REST API.

So, it seems that it should be the same if you are using:
“Asynchronous”: true
or
“Synchronous”: false

… but still, whatever I try result/response is the same, jobId is not returned, call is executed always synchronous and response is received when operation is done. I can see related job created and executed in the Orthanc console, but not as part of the response! I just tried both cases, the same thing happens when during instance or study modification.

I can see this parameter in definition of instance modification in a link you sent. It means that this should work as expected and return jobId, but it doesn’t.

Thanks,
Vedran

Hi Vedran,

Thanks, it sounds like both forms of documentation are incorrect. I’ll raise a bug on this.

Cheers,
Chris

Hello,

Here is how to modify a patient’s ID, in the (default) synchronous mode (the call ends once the patient has been entirely modified by the underlying job):

$ curl -v http://localhost:8042/patients/ef9d77db-eb3b2bef-9b31fd3e-bf42ae46-dbdb0cc3/modify -d ‘{“Replace”:{“PatientID”:“HELLO1”},“Force”:true,“Synchronous”:true}’

{
“ID” : “49302fdd-767c1066-9c8cc7bc-1266c4f0-cba35aee”,
“Path” : “/patients/49302fdd-767c1066-9c8cc7bc-1266c4f0-cba35aee”,
“PatientID” : “49302fdd-767c1066-9c8cc7bc-1266c4f0-cba35aee”,
“Type” : “Patient”
}

Here is how to modify a patient’s ID, in asynchronous mode (the caller gets the ID of the underlying job):

$ curl -v http://localhost:8042/patients/ef9d77db-eb3b2bef-9b31fd3e-bf42ae46-dbdb0cc3/modify -d ‘{“Replace”:{“PatientID”:“HELLO2”},“Force”:true,“Synchronous”:false}’

{
“ID” : “d3a2dad8-1b7f-4646-bf7f-3fcf72591f6c”,
“Path” : “/jobs/d3a2dad8-1b7f-4646-bf7f-3fcf72591f6c”
}

Note that this is a synonym for:

$ curl -v http://localhost:8042/patients/ef9d77db-eb3b2bef-9b31fd3e-bf42ae46-dbdb0cc3/modify -d ‘{“Replace”:{“PatientID”:“HELLO3”},“Force”:true,“Asynchronous”:true}’

{
“ID” : “c21405f3-a690-4b59-96b1-56a92932b0ca”,
“Path” : “/jobs/c21405f3-a690-4b59-96b1-56a92932b0ca”
}

Once the “ID” of the job is known, you can monitor/change the job as described on this entry of the Orthanc Book:
https://book.orthanc-server.com/users/advanced-rest.html#monitoring-jobs

HTH,
Sébastien-

Hello Sebastien,

All you mentioned is clear. I understand how this should work. At first, I tried with study, now I checked with patient as it is in your examples. For me it doesn’t work.

Now, I am thinking about the reason for that. Maybe version of the Orthanc is too old on my machine? I am using 1.4.0.2. What is minimum version where this should work?

I would like to upgrade Orthanc version on my machine, but there is one problem. In order to properly test some features of the Orthanc on my local machine, I didn’t install Orthanc (what will enable only one instance on my machine), but rather I did download folder with Orthanc executable files (see attached picture). I simulate multiple Orthanc instances by copying this folder multiple times, and of course by changing dicom port for every particular instance. I am not able to find this link anymore to download only executable files. I would like to have it in order to test everything locally. Is this link still somewhere?

Thanks,
Vedran

OrthancRootFolder.png

Hello,

Now, I am thinking about the reason for that. Maybe version of the Orthanc is too old on my machine? I am using 1.4.0.2. What is minimum version where this should work?

Indeed: This feature was introduced in Orthanc 1.5.0, so you have to upgrade.

I would like to upgrade Orthanc version on my machine, but there is one problem. In order to properly test some features of the Orthanc on my local machine, I didn’t install Orthanc (what will enable only one instance on my machine), but rather I did download folder with Orthanc executable files (see attached picture). I simulate multiple Orthanc instances by copying this folder multiple times, and of course by changing dicom port for every particular instance. I am not able to find this link anymore to download only executable files. I would like to have it in order to test everything locally. Is this link still somewhere?

I don’t know where this archive comes from. You can simply use the official Windows installer to retrieve the up-to-date .EXE / .DLL files, then uninstall the software:
https://www.orthanc-server.com/download-windows.php

HTH,
Sébastien-

I did upgrade. All works as expected!
Thanks a lot!
Vedran