comparison Sphinx/source/users/rest.rst @ 25:669ea65ba7fb

fix links
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 20 Jul 2016 09:26:08 +0200
parents 901e8961f46e
children 5737f51ff94e
comparison
equal deleted inserted replaced
24:25fa874803ab 25:669ea65ba7fb
18 of Orthanc) entirely resorts to this REST API for all its features. 18 of Orthanc) entirely resorts to this REST API for all its features.
19 This implies that anything that can be done through Orthanc Explorer, 19 This implies that anything that can be done through Orthanc Explorer,
20 can also be done through REST queries. 20 can also be done through REST queries.
21 21
22 *Note:* All the examples are illustrated with the `cURL command-line 22 *Note:* All the examples are illustrated with the `cURL command-line
23 tool <http://curl.haxx.se/>`__, but equivalent calls can be readily 23 tool <https://curl.haxx.se/>`__, but equivalent calls can be readily
24 transposed to any programming language that supports both HTTP and 24 transposed to any programming language that supports both HTTP and
25 JSON. 25 JSON.
26 26
27 27
28 Sending DICOM images 28 Sending DICOM images
48 48
49 .. highlight:: bash 49 .. highlight:: bash
50 50
51 Note that in the case of curl, setting the ``Expect`` HTTP Header will 51 Note that in the case of curl, setting the ``Expect`` HTTP Header will
52 significantly `reduce the execution time of POST requests 52 significantly `reduce the execution time of POST requests
53 <http://stackoverflow.com/a/463277/881731>`__:: 53 <http://stackoverflow.com/questions/463144/php-http-post-fails-when-curl-data-1024/463277#463277>`__::
54 54
55 $ curl -X POST -H "Expect:" http://localhost:8042/instances --data-binary @CT.X.1.2.276.0.7230010.dcm 55 $ curl -X POST -H "Expect:" http://localhost:8042/instances --data-binary @CT.X.1.2.276.0.7230010.dcm
56 56
57 The code distribution of Orthanc contains a `sample Python script 57 The code distribution of Orthanc contains a `sample Python script
58 <https://bitbucket.org/sjodogne/orthanc/src/default/Resources/Samples/ImportDicomFiles/ImportDicomFiles.py>`__ 58 <https://bitbucket.org/sjodogne/orthanc/src/default/Resources/Samples/ImportDicomFiles/ImportDicomFiles.py>`__
81 $ curl http://localhost:8042/studies 81 $ curl http://localhost:8042/studies
82 $ curl http://localhost:8042/series 82 $ curl http://localhost:8042/series
83 $ curl http://localhost:8042/instances 83 $ curl http://localhost:8042/instances
84 84
85 Note that the result of this command is a `JSON file 85 Note that the result of this command is a `JSON file
86 <http://en.wikipedia.org/wiki/Json>`__ that contains an array of 86 <https://en.wikipedia.org/wiki/Json>`__ that contains an array of
87 resource identifiers. The JSON file format is lightweight and can be 87 resource identifiers. The JSON file format is lightweight and can be
88 parsed from almost any computer language. 88 parsed from almost any computer language.
89 89
90 Accessing a patient 90 Accessing a patient
91 ^^^^^^^^^^^^^^^^^^^ 91 ^^^^^^^^^^^^^^^^^^^
92 92
93 .. highlight:: bash 93 .. highlight:: bash
94 94
95 To access a single resource, add its identifier to the `URI 95 To access a single resource, add its identifier to the `URI
96 <http://en.wikipedia.org/wiki/Uniform_resource_identifier>`__. You 96 <https://en.wikipedia.org/wiki/Uniform_resource_identifier>`__. You
97 would for instance retrieve the main information about one patient as 97 would for instance retrieve the main information about one patient as
98 follows:: 98 follows::
99 99
100 $ curl http://localhost:8042/patients/dc65762c-f476e8b9-898834f4-2f8a5014-2599bc94 100 $ curl http://localhost:8042/patients/dc65762c-f476e8b9-898834f4-2f8a5014-2599bc94
101 101
473 473
474 This output corresponds to the receiving of one single DICOM instance 474 This output corresponds to the receiving of one single DICOM instance
475 by Orthanc. It records that a new instance, a new series, a new study 475 by Orthanc. It records that a new instance, a new series, a new study
476 and a new patient has been created inside Orthanc. Note that each 476 and a new patient has been created inside Orthanc. Note that each
477 changes is labeled by a ``ChangeType``, a ``Date`` (in the `ISO format 477 changes is labeled by a ``ChangeType``, a ``Date`` (in the `ISO format
478 <http://en.wikipedia.org/wiki/ISO_8601>`__), the location of the 478 <https://en.wikipedia.org/wiki/ISO_8601>`__), the location of the
479 resource inside Orthanc, and a sequence number (``Seq``). 479 resource inside Orthanc, and a sequence number (``Seq``).
480 480
481 Note that this call is non-blocking. It is up to the calling program 481 Note that this call is non-blocking. It is up to the calling program
482 to wait for the occurrence of a new event (by implementing a polling 482 to wait for the occurrence of a new event (by implementing a polling
483 loop). 483 loop).