Mercurial > hg > orthanc-book
comparison Sphinx/source/plugins/python.rst @ 1013:ab270400aae1
python: overriding core API
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 09 Jan 2024 11:50:17 +0100 |
parents | 2e103fb1fa11 |
children | 868552e0caf8 |
comparison
equal
deleted
inserted
replaced
1012:34f30ddc0dec | 1013:ab270400aae1 |
---|---|
277 | 277 |
278 The route can then be accessed as:: | 278 The route can then be accessed as:: |
279 | 279 |
280 $ curl http://localhost:8042/toto | 280 $ curl http://localhost:8042/toto |
281 ok | 281 ok |
282 | |
283 | |
284 Overriding the core REST API | |
285 ............................ | |
286 | |
287 You may also use a python plugin to replace an existing REST API route: | |
288 | |
289 .. literalinclude:: python/extending-rest-api-2.py | |
290 :language: python | |
291 | |
292 | |
293 | |
294 When calling the REST API from a python plugin, you may use e.g. | |
295 ``RestApiPost`` to call the native Orthanc REST API and must | |
296 call ``RestApiPostAfterPlugin`` to call the REST API from plugins. | |
297 | |
298 | |
299 Note however, that, as of Orthanc 1.12.2, the Orthanc plugin SDK | |
300 does not support multiple plugins implementing the same route. | |
301 Orthanc will actually accept e.g a Python plugin that overrides | |
302 a DICOMWeb route but it is impossible to tell which route | |
303 will be called in the end since this depends on the registration | |
304 order of the plugins that is not deterministic. | |
305 | |
306 | |
282 | 307 |
283 | 308 |
284 .. _python-changes: | 309 .. _python-changes: |
285 | 310 |
286 Listening to changes | 311 Listening to changes |