comparison Sphinx/source/users/rest.rst @ 132:55a2ee3c462d

Performing Query/Retrieve with REST
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 23 Mar 2018 09:31:45 +0100
parents 736d30badda0
children 8e08909ab69b
comparison
equal deleted inserted replaced
131:f823ad1ef269 132:55a2ee3c462d
410 410
411 The list of the resources to be sent are given as a JSON array. In 411 The list of the resources to be sent are given as a JSON array. In
412 this case, a single DICOM connection is used. `Sample code is 412 this case, a single DICOM connection is used. `Sample code is
413 available 413 available
414 <https://bitbucket.org/sjodogne/orthanc/src/default/Resources/Samples/Python/HighPerformanceAutoRouting.py>`__. 414 <https://bitbucket.org/sjodogne/orthanc/src/default/Resources/Samples/Python/HighPerformanceAutoRouting.py>`__.
415
416
417 Performing Query/Retrieve with REST
418 -----------------------------------
419
420 *Section contributed by Bryan Dearlove*
421
422 Orthanc can be used to perform queries on the local Orthanc instance,
423 or on remote modalities through the REST API.
424
425 To perform a query of a remote modality you must define the modality
426 within the :ref:`configuration file <configuration>` (See
427 Configuration section under Sending resources to remote modalities).
428
429
430 Performing a Query on a Remote Modality
431 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
432
433 .. highlight:: bash
434
435 To initiate a query you perform a POST command against the Modality
436 with the identifiers you are looking for. The the example below we are
437 performing a study level query against the modality sample for any
438 study descriptions with the word chest within it. This search is case
439 insensitive unless configured otherwise within the Orthanc
440 configuration file::
441
442 $ curl --request POST \
443 --url http://localhost:8042/modalities/sample/query \
444 --data '{"Level":"Study","Query": {"PatientID":"","StudyDescription":"*Chest*","PatientName":""}}'
445
446
447 .. highlight:: json
448
449 You will receive back an ID which can be used to retrieve more information with GET commands or C-Move requests with a POST Command::
450
451 {
452 "ID": "5af318ac-78fb-47ff-b0b0-0df18b0588e0",
453 "Path": "/queries/5af318ac-78fb-47ff-b0b0-0df18b0588e0"
454 }
455
456
457 Additional Query Options
458 ^^^^^^^^^^^^^^^^^^^^^^^^
459
460 .. highlight:: json
461
462 You can use patient identifiers by including the `*` within your
463 search. For example if you were searching for a name beginning with
464 `Jones` you can do::
465
466 "PatientName":"Jones*".
467
468 If you wanted to search for a name with the words `Jo` anywhere within
469 it you can do::
470
471 "PatientName":"*Jo*".
472
473
474 Reviewing Level
475 ^^^^^^^^^^^^^^^
476
477 .. highlight:: bash
478
479 ::
480
481 $ curl --request GET --url http://localhost:8042/queries/5af318ac-78fb-47ff-b0b0-0df18b0588e0/level
482
483 Will retrieve the level with which the query was performed, Study,
484 Series or Instance.
485
486
487 Reviewing Modality
488 ^^^^^^^^^^^^^^^^^^
489
490 .. highlight:: bash
491
492 ::
493
494 $ curl --request GET --url http://localhost:8042/queries/5af318ac-78fb-47ff-b0b0-0df18b0588e0/modality
495
496 Will provide the modality name which the original query was performed against.
497
498
499 Reviewing Query
500 ^^^^^^^^^^^^^^^
501
502 .. highlight:: bash
503
504 To retrieve information on what identifiers the query was originally
505 performed using you can use the query filter::
506
507 $ curl --request GET --url http://localhost:8042/queries/5af318ac-78fb-47ff-b0b0-0df18b0588e0/query
508
509
510 Reviewing Query Answers
511 ^^^^^^^^^^^^^^^^^^^^^^^
512
513 .. highlight:: bash
514
515 You are able to individually review each answer returned by performing
516 a GET with the answers parameter::
517
518 $ curl --request GET --url http://localhost:8042/queries/5af318ac-78fb-47ff-b0b0-0df18b0588e0/answers
519
520 You will get a JSON back with numbered identifiers for each answer you
521 received back. For example because we performed a Study level query we
522 received back 5 studies answers back. We are able to query each answer
523 for content details::
524
525 $ curl --request GET --url http://localhost:8042/queries/5af318ac-78fb-47ff-b0b0-0df18b0588e0/answers/0/content
526
527 If there are content items missing, you may add them by adding that
528 identifier to the original query. For example if we wanted Modalities
529 listed in this JSON answer in the initial query we would add to the
530 POST body: `"ModalitiesInStudy":""`
531
532
533 Performing Retrieve (C-Move)
534 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
535
536 .. highlight:: bash
537
538 You can perform a C-Move to retrieve all studies within the original
539 query using a post command and identifying the Modality to be one to
540 in the POST contents::
541
542 $ curl --request POST --url http://localhost:8042/queries/5af318ac-78fb-47ff-b0b0-0df18b0588e0/retrieve --data Orthanc
543
544 You are also able to perform individual C-Moves for a content item by
545 specifying that individual content item::
546
547 $ curl --request POST --url http://localhost:8042/queries/5af318ac-78fb-47ff-b0b0-0df18b0588e0/answers/0/retrieve --data Orthanc
415 548
416 549
417 Tracking changes 550 Tracking changes
418 ---------------- 551 ----------------
419 552