Hello,
For a project at my university I am trying to receive studies from a distant modality via the RESTful API.
I installed Orthanc on windows and added the dicomserver.co.uk with port 104 to my modalities in the configuration file.
The dicomserver.co.uk states it will commmunicate with anyone and AE titles and IP addresses are not checked or restricted.
By
curl -v -d -X GET http://localhost:8042/modalities/DICOMserver/echo
I get a positive Response.
By
curl -v POST http://localhost:8042/modalities/DICOMserver/store -d “some-study-ID”
I can successfully store the study on the Server.
But when trying to query via
curl -v POST http://localhost:8042/modalities/DICOMserver/query -d ‘{“PatientName”:“*”,“PatientSex”:“M”}’
I always get a “Bad Request”.
Do I mess up my query or does the /modalities/…/query not work?
Thanks already for any help =)
Robert
jodogne
February 28, 2018, 8:42pm
2
Hello,
The “test_rest_query_retrieve” integration test of Orthanc gives an example about the use of the “/modalities/{…}/query” URI:
https://bitbucket.org/sjodogne/orthanc-tests/src/90e5331ddee905afbe4657e7547c8e10bdb2349d/Tests/Tests.py#Tests.py-1548
Basically, you have to specify an additional “Level” argument.
HTH,
Sébastien-
Thank you for your Quick answer at this late hour.
so I now tried it like this:
curl -v -X POST http://localhost:8042/modalities/DICOMserver/query -d “{‘Level’:‘Series’,‘Query’:{‘PatientName’:‘‘,‘PatientSex’:’ ’}}”
Below is what the verbose output provided:
Note: Unnecessary use of -X or --request, POST is already inferred.
Trying ::1…
TCP_NODELAY set
Trying 127.0.0.1…
TCP_NODELAY set
Connected to localhost (127.0.0.1) port 8042 (#0 )
POST /modalities/DICOMserver/query HTTP/1.1
Host: localhost:8042
User-Agent: curl/7.58.0
Accept: /
Content-Length: 63
Content-Type: application/x-www-form-urlencoded
upload completely sent off: 63 out of 63 bytes
< HTTP/1.1 400 Bad Request
< Content-Length: 0
<
Connection #0 to host localhost left intact
Am I still doing it wrong, or is there some other issue?
jodogne
February 28, 2018, 9:17pm
4
At the command line, you must swap the single quotes and the double quotes, e.g. (untested):