annotate OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp @ 5857:39996519afce find-refactoring

fix limit/since restrictions
author Alain Mazy <am@orthanc.team>
date Mon, 04 Nov 2024 22:06:45 +0100
parents 56352ae88120
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
4 * Department, University Hospital of Liege, Belgium
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5536
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5536
diff changeset
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5433
diff changeset
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 *
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * This program is free software: you can redistribute it and/or
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * modify it under the terms of the GNU General Public License as
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * published by the Free Software Foundation, either version 3 of the
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * License, or (at your option) any later version.
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 *
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful, but
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * General Public License for more details.
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 *
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 **/
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
831
84513f2ee1f3 pch for unit tests and server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
24 #include "../PrecompiledHeadersServer.h"
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "OrthancRestApi.h"
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
4045
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
27 #include "../../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h"
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
28 #include "../../../OrthancFramework/Sources/MetricsRegistry.h"
3097
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
29 #include "../../Plugins/Engine/OrthancPlugins.h"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
30 #include "../../Plugins/Engine/PluginsManager.h"
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2908
diff changeset
31 #include "../OrthancConfiguration.h"
4273
0034f855c023 tuning log categories from command-line, and binary compat with orthanc framework 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4143
diff changeset
32 #include "../OrthancInitialization.h"
1437
02f5a3f5c0a0 access to the REST API from Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1434
diff changeset
33 #include "../ServerContext.h"
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
4275
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
35 #include <boost/algorithm/string/predicate.hpp>
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
36
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 namespace Orthanc
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 {
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 // System information -------------------------------------------------------
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
42 static void ServeRoot(RestApiGetCall& call)
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 {
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 call.GetOutput().Redirect("app/explorer.html");
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
4461
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
47 static void ServeFavicon(RestApiGetCall& call)
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
48 {
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
49 call.GetOutput().Redirect("app/images/favicon.ico");
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
50 }
4950
3778a0433dd3 new field 'MainDicomTags' in the /system response
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
51
3778a0433dd3 new field 'MainDicomTags' in the /system response
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
52 static void GetMainDicomTagsConfiguration(Json::Value& result)
3778a0433dd3 new field 'MainDicomTags' in the /system response
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
53 {
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents: 4950
diff changeset
54 result["Patient"] = DicomMap::GetMainDicomTagsSignature(ResourceType_Patient);
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents: 4950
diff changeset
55 result["Study"] = DicomMap::GetMainDicomTagsSignature(ResourceType_Study);
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents: 4950
diff changeset
56 result["Series"] = DicomMap::GetMainDicomTagsSignature(ResourceType_Series);
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents: 4950
diff changeset
57 result["Instance"] = DicomMap::GetMainDicomTagsSignature(ResourceType_Instance);
4950
3778a0433dd3 new field 'MainDicomTags' in the /system response
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
58 }
3778a0433dd3 new field 'MainDicomTags' in the /system response
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
59
5204
08e0c9c0ab39 added UserMetadata in /system
Alain Mazy <am@osimis.io>
parents: 5200
diff changeset
60 static void GetUserMetadataConfiguration(Json::Value& result)
08e0c9c0ab39 added UserMetadata in /system
Alain Mazy <am@osimis.io>
parents: 5200
diff changeset
61 {
08e0c9c0ab39 added UserMetadata in /system
Alain Mazy <am@osimis.io>
parents: 5200
diff changeset
62 std::map<std::string, int> userMetadata;
08e0c9c0ab39 added UserMetadata in /system
Alain Mazy <am@osimis.io>
parents: 5200
diff changeset
63 Orthanc::GetRegisteredUserMetadata(userMetadata);
08e0c9c0ab39 added UserMetadata in /system
Alain Mazy <am@osimis.io>
parents: 5200
diff changeset
64
08e0c9c0ab39 added UserMetadata in /system
Alain Mazy <am@osimis.io>
parents: 5200
diff changeset
65 for (std::map<std::string, int>::const_iterator it = userMetadata.begin(); it != userMetadata.end(); ++it)
08e0c9c0ab39 added UserMetadata in /system
Alain Mazy <am@osimis.io>
parents: 5200
diff changeset
66 {
08e0c9c0ab39 added UserMetadata in /system
Alain Mazy <am@osimis.io>
parents: 5200
diff changeset
67 result[it->first] = it->second;
08e0c9c0ab39 added UserMetadata in /system
Alain Mazy <am@osimis.io>
parents: 5200
diff changeset
68 }
08e0c9c0ab39 added UserMetadata in /system
Alain Mazy <am@osimis.io>
parents: 5200
diff changeset
69 }
08e0c9c0ab39 added UserMetadata in /system
Alain Mazy <am@osimis.io>
parents: 5200
diff changeset
70
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
71 static void GetSystemInformation(RestApiGetCall& call)
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 {
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
73 static const char* const API_VERSION = "ApiVersion";
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
74 static const char* const CHECK_REVISIONS = "CheckRevisions";
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
75 static const char* const DATABASE_BACKEND_PLUGIN = "DatabaseBackendPlugin";
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
76 static const char* const DATABASE_VERSION = "DatabaseVersion";
5024
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents: 4988
diff changeset
77 static const char* const DATABASE_SERVER_IDENTIFIER = "DatabaseServerIdentifier";
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
78 static const char* const DICOM_AET = "DicomAet";
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
79 static const char* const DICOM_PORT = "DicomPort";
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
80 static const char* const HTTP_PORT = "HttpPort";
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
81 static const char* const IS_HTTP_SERVER_SECURE = "IsHttpServerSecure";
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
82 static const char* const NAME = "Name";
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
83 static const char* const PLUGINS_ENABLED = "PluginsEnabled";
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
84 static const char* const STORAGE_AREA_PLUGIN = "StorageAreaPlugin";
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
85 static const char* const VERSION = "Version";
4950
3778a0433dd3 new field 'MainDicomTags' in the /system response
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
86 static const char* const MAIN_DICOM_TAGS = "MainDicomTags";
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
87 static const char* const STORAGE_COMPRESSION = "StorageCompression";
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4979
diff changeset
88 static const char* const OVERWRITE_INSTANCES = "OverwriteInstances";
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4979
diff changeset
89 static const char* const INGEST_TRANSCODING = "IngestTranscoding";
5120
a6fa660ec26e /system: added MaximumStorageMode and MaximumStorageSize
Alain Mazy <am@osimis.io>
parents: 5111
diff changeset
90 static const char* const MAXIMUM_STORAGE_SIZE = "MaximumStorageSize";
5533
72511fbd1605 Added MaximumPatientCount in /system
Alain Mazy <am@osimis.io>
parents: 5485
diff changeset
91 static const char* const MAXIMUM_PATIENT_COUNT = "MaximumPatientCount";
5120
a6fa660ec26e /system: added MaximumStorageMode and MaximumStorageSize
Alain Mazy <am@osimis.io>
parents: 5111
diff changeset
92 static const char* const MAXIMUM_STORAGE_MODE = "MaximumStorageMode";
5204
08e0c9c0ab39 added UserMetadata in /system
Alain Mazy <am@osimis.io>
parents: 5200
diff changeset
93 static const char* const USER_METADATA = "UserMetadata";
5238
367e8af46cfd added "HasLabels" in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5204
diff changeset
94 static const char* const HAS_LABELS = "HasLabels";
5757
5463c3ae3235 refactored extended /changes
Alain Mazy <am@orthanc.team>
parents: 5663
diff changeset
95 static const char* const CAPABILITIES = "Capabilities";
5463c3ae3235 refactored extended /changes
Alain Mazy <am@orthanc.team>
parents: 5663
diff changeset
96 static const char* const HAS_EXTENDED_CHANGES = "HasExtendedChanges";
5776
de33982a0bf4 wip: started implementing Find in PostgreSQL
Alain Mazy <am@orthanc.team>
parents: 5757
diff changeset
97 static const char* const HAS_EXTENDED_FIND = "HasExtendedFind";
5783
56352ae88120 wip: new ReadOnly configuration
Alain Mazy <am@orthanc.team>
parents: 5776
diff changeset
98 static const char* const READ_ONLY = "ReadOnly";
5120
a6fa660ec26e /system: added MaximumStorageMode and MaximumStorageSize
Alain Mazy <am@osimis.io>
parents: 5111
diff changeset
99
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
100 if (call.IsDocumentation())
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
101 {
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
102 call.GetDocumentation()
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
103 .SetTag("System")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
104 .SetSummary("Get system information")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
105 .SetDescription("Get system information about Orthanc")
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
106 .SetAnswerField(API_VERSION, RestApiCallDocumentation::Type_Number, "Version of the REST API")
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
107 .SetAnswerField(VERSION, RestApiCallDocumentation::Type_String, "Version of Orthanc")
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
108 .SetAnswerField(DATABASE_VERSION, RestApiCallDocumentation::Type_Number,
5432
59e3b6f8c5be migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5431
diff changeset
109 "Version of the database: https://orthanc.uclouvain.be/book/developers/db-versioning.html")
5024
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents: 4988
diff changeset
110 .SetAnswerField(DATABASE_SERVER_IDENTIFIER, RestApiCallDocumentation::Type_String,
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents: 4988
diff changeset
111 "ID of the server in the database (when running multiple Orthanc on the same DB)")
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
112 .SetAnswerField(IS_HTTP_SERVER_SECURE, RestApiCallDocumentation::Type_Boolean,
5432
59e3b6f8c5be migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5431
diff changeset
113 "Whether the REST API is properly secured (assuming no reverse proxy is in use): https://orthanc.uclouvain.be/book/faq/security.html#securing-the-http-server")
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
114 .SetAnswerField(STORAGE_AREA_PLUGIN, RestApiCallDocumentation::Type_String,
4403
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
115 "Information about the installed storage area plugin (`null` if no such plugin is installed)")
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
116 .SetAnswerField(DATABASE_BACKEND_PLUGIN, RestApiCallDocumentation::Type_String,
4403
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
117 "Information about the installed database index plugin (`null` if no such plugin is installed)")
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
118 .SetAnswerField(DICOM_AET, RestApiCallDocumentation::Type_String, "The DICOM AET of Orthanc")
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
119 .SetAnswerField(DICOM_PORT, RestApiCallDocumentation::Type_Number, "The port to the DICOM server of Orthanc")
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
120 .SetAnswerField(HTTP_PORT, RestApiCallDocumentation::Type_Number, "The port to the HTTP server of Orthanc")
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
121 .SetAnswerField(NAME, RestApiCallDocumentation::Type_String,
4403
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
122 "The name of the Orthanc server, cf. the `Name` configuration option")
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
123 .SetAnswerField(PLUGINS_ENABLED, RestApiCallDocumentation::Type_Boolean,
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
124 "Whether Orthanc was built with support for plugins")
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
125 .SetAnswerField(CHECK_REVISIONS, RestApiCallDocumentation::Type_Boolean,
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
126 "Whether Orthanc handle revisions of metadata and attachments to deal with multiple writers (new in Orthanc 1.9.2)")
4950
3778a0433dd3 new field 'MainDicomTags' in the /system response
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
127 .SetAnswerField(MAIN_DICOM_TAGS, RestApiCallDocumentation::Type_JsonObject,
3778a0433dd3 new field 'MainDicomTags' in the /system response
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
128 "The list of MainDicomTags saved in DB for each resource level (new in Orthanc 1.11.0)")
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
129 .SetAnswerField(STORAGE_COMPRESSION, RestApiCallDocumentation::Type_Boolean,
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
130 "Whether storage compression is enabled (new in Orthanc 1.11.0)")
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4979
diff changeset
131 .SetAnswerField(OVERWRITE_INSTANCES, RestApiCallDocumentation::Type_Boolean,
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4979
diff changeset
132 "Whether instances are overwritten when re-ingested (new in Orthanc 1.11.0)")
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4979
diff changeset
133 .SetAnswerField(INGEST_TRANSCODING, RestApiCallDocumentation::Type_String,
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4979
diff changeset
134 "Whether instances are transcoded when ingested into Orthanc (`""` if no transcoding is performed) (new in Orthanc 1.11.0)")
5120
a6fa660ec26e /system: added MaximumStorageMode and MaximumStorageSize
Alain Mazy <am@osimis.io>
parents: 5111
diff changeset
135 .SetAnswerField(MAXIMUM_STORAGE_SIZE, RestApiCallDocumentation::Type_Number,
a6fa660ec26e /system: added MaximumStorageMode and MaximumStorageSize
Alain Mazy <am@osimis.io>
parents: 5111
diff changeset
136 "The configured MaximumStorageSize in MB (new in Orthanc 1.11.3)")
5533
72511fbd1605 Added MaximumPatientCount in /system
Alain Mazy <am@osimis.io>
parents: 5485
diff changeset
137 .SetAnswerField(MAXIMUM_PATIENT_COUNT, RestApiCallDocumentation::Type_Number,
72511fbd1605 Added MaximumPatientCount in /system
Alain Mazy <am@osimis.io>
parents: 5485
diff changeset
138 "The configured MaximumPatientCount (new in Orthanc 1.12.4)")
5120
a6fa660ec26e /system: added MaximumStorageMode and MaximumStorageSize
Alain Mazy <am@osimis.io>
parents: 5111
diff changeset
139 .SetAnswerField(MAXIMUM_STORAGE_MODE, RestApiCallDocumentation::Type_String,
a6fa660ec26e /system: added MaximumStorageMode and MaximumStorageSize
Alain Mazy <am@osimis.io>
parents: 5111
diff changeset
140 "The configured MaximumStorageMode (new in Orthanc 1.11.3)")
5204
08e0c9c0ab39 added UserMetadata in /system
Alain Mazy <am@osimis.io>
parents: 5200
diff changeset
141 .SetAnswerField(USER_METADATA, RestApiCallDocumentation::Type_JsonObject,
08e0c9c0ab39 added UserMetadata in /system
Alain Mazy <am@osimis.io>
parents: 5200
diff changeset
142 "The configured UserMetadata (new in Orthanc 1.12.0)")
5238
367e8af46cfd added "HasLabels" in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5204
diff changeset
143 .SetAnswerField(HAS_LABELS, RestApiCallDocumentation::Type_Boolean,
367e8af46cfd added "HasLabels" in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5204
diff changeset
144 "Whether the database back-end supports labels (new in Orthanc 1.12.0)")
5757
5463c3ae3235 refactored extended /changes
Alain Mazy <am@orthanc.team>
parents: 5663
diff changeset
145 .SetAnswerField(CAPABILITIES, RestApiCallDocumentation::Type_JsonObject,
5776
de33982a0bf4 wip: started implementing Find in PostgreSQL
Alain Mazy <am@orthanc.team>
parents: 5757
diff changeset
146 "Whether the back-end supports optional features like 'HasExtendedChanges', 'HasExtendedFind' (new in Orthanc 1.12.5) ")
5783
56352ae88120 wip: new ReadOnly configuration
Alain Mazy <am@orthanc.team>
parents: 5776
diff changeset
147 .SetAnswerField(READ_ONLY, RestApiCallDocumentation::Type_Boolean,
56352ae88120 wip: new ReadOnly configuration
Alain Mazy <am@orthanc.team>
parents: 5776
diff changeset
148 "Whether Orthanc is running in read only mode (new in Orthanc 1.12.5)")
5432
59e3b6f8c5be migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5431
diff changeset
149 .SetHttpGetSample("https://orthanc.uclouvain.be/demo/system", true);
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
150 return;
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
151 }
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
152
3533
2090ec6a83a5 create a default user if none is provided, while issuing a warning in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3526
diff changeset
153 ServerContext& context = OrthancRestApi::GetContext(call);
2090ec6a83a5 create a default user if none is provided, while issuing a warning in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3526
diff changeset
154
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 Json::Value result = Json::objectValue;
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
157 result[API_VERSION] = ORTHANC_API_VERSION;
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
158 result[VERSION] = ORTHANC_VERSION;
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
159 result[DATABASE_VERSION] = OrthancRestApi::GetIndex(call).GetDatabaseVersion();
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
160 result[IS_HTTP_SERVER_SECURE] = context.IsHttpServerSecure(); // New in Orthanc 1.5.8
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2908
diff changeset
161
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2908
diff changeset
162 {
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2908
diff changeset
163 OrthancConfiguration::ReaderLock lock;
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
164 result[DICOM_AET] = lock.GetConfiguration().GetOrthancAET();
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
165 result[DICOM_PORT] = lock.GetConfiguration().GetUnsignedIntegerParameter(DICOM_PORT, 4242);
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
166 result[HTTP_PORT] = lock.GetConfiguration().GetUnsignedIntegerParameter(HTTP_PORT, 8042);
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
167 result[NAME] = lock.GetConfiguration().GetStringParameter(NAME, "");
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
168 result[CHECK_REVISIONS] = lock.GetConfiguration().GetBooleanParameter(CHECK_REVISIONS, false); // New in Orthanc 1.9.2
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
169 result[STORAGE_COMPRESSION] = lock.GetConfiguration().GetBooleanParameter(STORAGE_COMPRESSION, false); // New in Orthanc 1.11.0
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4979
diff changeset
170 result[OVERWRITE_INSTANCES] = lock.GetConfiguration().GetBooleanParameter(OVERWRITE_INSTANCES, false); // New in Orthanc 1.11.0
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4979
diff changeset
171 result[INGEST_TRANSCODING] = lock.GetConfiguration().GetStringParameter(INGEST_TRANSCODING, ""); // New in Orthanc 1.11.0
5024
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents: 4988
diff changeset
172 result[DATABASE_SERVER_IDENTIFIER] = lock.GetConfiguration().GetDatabaseServerIdentifier();
5120
a6fa660ec26e /system: added MaximumStorageMode and MaximumStorageSize
Alain Mazy <am@osimis.io>
parents: 5111
diff changeset
173 result[MAXIMUM_STORAGE_SIZE] = lock.GetConfiguration().GetUnsignedIntegerParameter(MAXIMUM_STORAGE_SIZE, 0); // New in Orthanc 1.11.3
5536
7c372a95c7e9 fix comment
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5533
diff changeset
174 result[MAXIMUM_PATIENT_COUNT] = lock.GetConfiguration().GetUnsignedIntegerParameter(MAXIMUM_PATIENT_COUNT, 0); // New in Orthanc 1.12.4
5120
a6fa660ec26e /system: added MaximumStorageMode and MaximumStorageSize
Alain Mazy <am@osimis.io>
parents: 5111
diff changeset
175 result[MAXIMUM_STORAGE_MODE] = lock.GetConfiguration().GetStringParameter(MAXIMUM_STORAGE_MODE, "Recycle"); // New in Orthanc 1.11.3
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2908
diff changeset
176 }
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
178 result[STORAGE_AREA_PLUGIN] = Json::nullValue;
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
179 result[DATABASE_BACKEND_PLUGIN] = Json::nullValue;
5783
56352ae88120 wip: new ReadOnly configuration
Alain Mazy <am@orthanc.team>
parents: 5776
diff changeset
180 result[READ_ONLY] = context.IsReadOnly();
1630
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
181
2136
dd609a99d39a uniformization of the macro naming
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2069
diff changeset
182 #if ORTHANC_ENABLE_PLUGINS == 1
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
183 result[PLUGINS_ENABLED] = true;
3533
2090ec6a83a5 create a default user if none is provided, while issuing a warning in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3526
diff changeset
184 const OrthancPlugins& plugins = context.GetPlugins();
1630
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
185
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
186 if (plugins.HasStorageArea())
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
187 {
1631
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1630
diff changeset
188 std::string p = plugins.GetStorageAreaLibrary().GetPath();
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
189 result[STORAGE_AREA_PLUGIN] = boost::filesystem::canonical(p).string();
1630
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
190 }
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
191
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
192 if (plugins.HasDatabaseBackend())
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
193 {
1631
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1630
diff changeset
194 std::string p = plugins.GetDatabaseBackendLibrary().GetPath();
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
195 result[DATABASE_BACKEND_PLUGIN] = boost::filesystem::canonical(p).string();
1630
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
196 }
1632
eb8fbcf008b5 fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1631
diff changeset
197 #else
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4474
diff changeset
198 result[PLUGINS_ENABLED] = false;
1632
eb8fbcf008b5 fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1631
diff changeset
199 #endif
1630
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
200
4950
3778a0433dd3 new field 'MainDicomTags' in the /system response
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
201 result[MAIN_DICOM_TAGS] = Json::objectValue;
3778a0433dd3 new field 'MainDicomTags' in the /system response
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
202 GetMainDicomTagsConfiguration(result[MAIN_DICOM_TAGS]);
3778a0433dd3 new field 'MainDicomTags' in the /system response
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
203
5204
08e0c9c0ab39 added UserMetadata in /system
Alain Mazy <am@osimis.io>
parents: 5200
diff changeset
204 result[USER_METADATA] = Json::objectValue;
08e0c9c0ab39 added UserMetadata in /system
Alain Mazy <am@osimis.io>
parents: 5200
diff changeset
205 GetUserMetadataConfiguration(result[USER_METADATA]);
08e0c9c0ab39 added UserMetadata in /system
Alain Mazy <am@osimis.io>
parents: 5200
diff changeset
206
5238
367e8af46cfd added "HasLabels" in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5204
diff changeset
207 result[HAS_LABELS] = OrthancRestApi::GetIndex(call).HasLabelsSupport();
5757
5463c3ae3235 refactored extended /changes
Alain Mazy <am@orthanc.team>
parents: 5663
diff changeset
208 result[CAPABILITIES] = Json::objectValue;
5463c3ae3235 refactored extended /changes
Alain Mazy <am@orthanc.team>
parents: 5663
diff changeset
209 result[CAPABILITIES][HAS_EXTENDED_CHANGES] = OrthancRestApi::GetIndex(call).HasExtendedChanges();
5776
de33982a0bf4 wip: started implementing Find in PostgreSQL
Alain Mazy <am@orthanc.team>
parents: 5757
diff changeset
210 result[CAPABILITIES][HAS_EXTENDED_FIND] = OrthancRestApi::GetIndex(call).HasFindSupport();
5238
367e8af46cfd added "HasLabels" in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5204
diff changeset
211
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 call.GetOutput().AnswerJson(result);
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
215 static void GetStatistics(RestApiGetCall& call)
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 {
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
217 if (call.IsDocumentation())
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
218 {
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
219 call.GetDocumentation()
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
220 .SetTag("System")
4403
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
221 .SetSummary("Get database statistics")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
222 .SetDescription("Get statistics related to the database of Orthanc")
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
223 .SetAnswerField("CountInstances", RestApiCallDocumentation::Type_Number, "Number of DICOM instances stored in Orthanc")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
224 .SetAnswerField("CountSeries", RestApiCallDocumentation::Type_Number, "Number of DICOM series stored in Orthanc")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
225 .SetAnswerField("CountStudies", RestApiCallDocumentation::Type_Number, "Number of DICOM studies stored in Orthanc")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
226 .SetAnswerField("CountPatients", RestApiCallDocumentation::Type_Number, "Number of patients stored in Orthanc")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
227 .SetAnswerField("TotalDiskSize", RestApiCallDocumentation::Type_String, "Size of the storage area (in bytes)")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
228 .SetAnswerField("TotalDiskSizeMB", RestApiCallDocumentation::Type_Number, "Size of the storage area (in megabytes)")
4403
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
229 .SetAnswerField("TotalUncompressedSize", RestApiCallDocumentation::Type_String, "Total size of all the files once uncompressed (in bytes). This corresponds to `TotalDiskSize` if no compression is enabled, cf. `StorageCompression` configuration option")
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
230 .SetAnswerField("TotalUncompressedSizeMB", RestApiCallDocumentation::Type_Number, "Total size of all the files once uncompressed (in megabytes)")
5432
59e3b6f8c5be migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5431
diff changeset
231 .SetHttpGetSample("https://orthanc.uclouvain.be/demo/statistics", true);
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
232 return;
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
233 }
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
234
3174
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
235 static const uint64_t MEGA_BYTES = 1024 * 1024;
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
236
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
237 uint64_t diskSize, uncompressedSize, countPatients, countStudies, countSeries, countInstances;
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
238 OrthancRestApi::GetIndex(call).GetGlobalStatistics(diskSize, uncompressedSize, countPatients,
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
239 countStudies, countSeries, countInstances);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
240
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 Json::Value result = Json::objectValue;
3174
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
242 result["TotalDiskSize"] = boost::lexical_cast<std::string>(diskSize);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
243 result["TotalUncompressedSize"] = boost::lexical_cast<std::string>(uncompressedSize);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
244 result["TotalDiskSizeMB"] = static_cast<unsigned int>(diskSize / MEGA_BYTES);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
245 result["TotalUncompressedSizeMB"] = static_cast<unsigned int>(uncompressedSize / MEGA_BYTES);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
246 result["CountPatients"] = static_cast<unsigned int>(countPatients);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
247 result["CountStudies"] = static_cast<unsigned int>(countStudies);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
248 result["CountSeries"] = static_cast<unsigned int>(countSeries);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
249 result["CountInstances"] = static_cast<unsigned int>(countInstances);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
250
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 call.GetOutput().AnswerJson(result);
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
254 static void GenerateUid(RestApiGetCall& call)
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 {
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
256 if (call.IsDocumentation())
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
257 {
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
258 call.GetDocumentation()
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
259 .SetTag("System")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
260 .SetSummary("Generate an identifier")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
261 .SetDescription("Generate a random DICOM identifier")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
262 .SetHttpGetArgument("level", RestApiCallDocumentation::Type_String,
4403
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
263 "Type of DICOM resource among: `patient`, `study`, `series` or `instance`", true)
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
264 .AddAnswerType(MimeType_PlainText, "The generated identifier");
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
265 return;
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
266 }
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
267
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 std::string level = call.GetArgument("level", "");
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 if (level == "patient")
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 {
2908
9d277f8ad698 new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2905
diff changeset
271 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Patient), MimeType_PlainText);
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 else if (level == "study")
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 {
2908
9d277f8ad698 new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2905
diff changeset
275 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Study), MimeType_PlainText);
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 else if (level == "series")
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 {
2908
9d277f8ad698 new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2905
diff changeset
279 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Series), MimeType_PlainText);
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 else if (level == "instance")
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 {
2908
9d277f8ad698 new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2905
diff changeset
283 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Instance), MimeType_PlainText);
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 }
5144
9fc5bf6f3c75 error message if level not specified in /tools/generate-uid
Alain Mazy <am@osimis.io>
parents: 5120
diff changeset
285 else
9fc5bf6f3c75 error message if level not specified in /tools/generate-uid
Alain Mazy <am@osimis.io>
parents: 5120
diff changeset
286 {
9fc5bf6f3c75 error message if level not specified in /tools/generate-uid
Alain Mazy <am@osimis.io>
parents: 5120
diff changeset
287 LOG(ERROR) << "No 'level' or invalid GET argument specified in /tools/generate-uid";
9fc5bf6f3c75 error message if level not specified in /tools/generate-uid
Alain Mazy <am@osimis.io>
parents: 5120
diff changeset
288 }
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
291 static void ExecuteScript(RestApiPostCall& call)
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 {
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
293 if (call.IsDocumentation())
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
294 {
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
295 call.GetDocumentation()
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
296 .SetTag("System")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
297 .SetSummary("Execute Lua script")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
298 .SetDescription("Execute the provided Lua script by the Orthanc server. This is very insecure for "
5200
f8f1c4a9a216 New configuration option 'RestApiWriteToFileSystemEnabled'
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
299 "Orthanc servers that are remotely accessible. Since Orthanc 1.5.8, this route "
f8f1c4a9a216 New configuration option 'RestApiWriteToFileSystemEnabled'
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
300 "is disabled by default and can be enabled thanks to the `ExecuteLuaEnabled` configuration.")
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
301 .AddRequestType(MimeType_PlainText, "The Lua script to be executed")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
302 .AddAnswerType(MimeType_PlainText, "Output of the Lua script");
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
303 return;
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
304 }
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
305
3535
41365091a41e display a security warning in the logs at startup when ExecuteLuaEnabled is true
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
306 ServerContext& context = OrthancRestApi::GetContext(call);
3526
f07352e0375c new configuration option ExecuteLuaEnabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3401
diff changeset
307
3535
41365091a41e display a security warning in the logs at startup when ExecuteLuaEnabled is true
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
308 if (!context.IsExecuteLuaEnabled())
41365091a41e display a security warning in the logs at startup when ExecuteLuaEnabled is true
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
309 {
41365091a41e display a security warning in the logs at startup when ExecuteLuaEnabled is true
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
310 LOG(ERROR) << "The URI /tools/execute-script is disallowed for security, "
5200
f8f1c4a9a216 New configuration option 'RestApiWriteToFileSystemEnabled'
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
311 << "check your configuration option `ExecuteLuaEnabled`";
3535
41365091a41e display a security warning in the logs at startup when ExecuteLuaEnabled is true
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
312 call.GetOutput().SignalError(HttpStatus_403_Forbidden);
41365091a41e display a security warning in the logs at startup when ExecuteLuaEnabled is true
Alain Mazy <alain@mazy.be>
parents: 3534
diff changeset
313 return;
3526
f07352e0375c new configuration option ExecuteLuaEnabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3401
diff changeset
314 }
f07352e0375c new configuration option ExecuteLuaEnabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3401
diff changeset
315
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 std::string result;
1446
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1437
diff changeset
317 std::string command;
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1437
diff changeset
318 call.BodyToString(command);
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1437
diff changeset
319
996
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 974
diff changeset
320 {
2617
912a767911b0 back to a single Lua context
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2616
diff changeset
321 LuaScripting::Lock lock(context.GetLuaScripting());
2616
2f3007bf0708 event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2612
diff changeset
322 lock.GetLua().Execute(result, command);
996
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 974
diff changeset
323 }
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 974
diff changeset
324
2908
9d277f8ad698 new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2905
diff changeset
325 call.GetOutput().AnswerBuffer(result, MimeType_PlainText);
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327
2475
8cc3ca64a534 Orthanc now uses UTC (universal time) instead of local time in its database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
328 template <bool UTC>
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
329 static void GetNowIsoString(RestApiGetCall& call)
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 {
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
331 if (call.IsDocumentation())
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
332 {
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
333 std::string type(UTC ? "UTC" : "local");
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
334 call.GetDocumentation()
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
335 .SetTag("System")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
336 .SetSummary("Get " + type + " time")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
337 .AddAnswerType(MimeType_PlainText, "The " + type + " time")
5433
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5432
diff changeset
338 .SetHttpGetSample("https://orthanc.uclouvain.be/demo" + call.FlattenUri(), false);
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
339 return;
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
340 }
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
341
2908
9d277f8ad698 new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2905
diff changeset
342 call.GetOutput().AnswerBuffer(SystemToolbox::GetNowIsoString(UTC), MimeType_PlainText);
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
343 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
345
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
346 static void GetDicomConformanceStatement(RestApiGetCall& call)
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
347 {
4403
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
348 if (call.IsDocumentation())
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
349 {
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
350 call.GetDocumentation()
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
351 .SetTag("System")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
352 .SetSummary("Get DICOM conformance")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
353 .SetDescription("Get the DICOM conformance statement of Orthanc")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
354 .AddAnswerType(MimeType_PlainText, "The DICOM conformance statement");
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
355 return;
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
356 }
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
357
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
358 std::string statement;
4031
e3b3af80732d ServerResources, and moving EmbeddedResourceHttpHandler from Core to OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3672
diff changeset
359 GetFileResource(statement, ServerResources::DICOM_CONFORMANCE_STATEMENT);
2908
9d277f8ad698 new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2905
diff changeset
360 call.GetOutput().AnswerBuffer(statement, MimeType_PlainText);
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
361 }
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
362
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
363
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
364 static void GetDefaultEncoding(RestApiGetCall& call)
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
365 {
4403
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
366 if (call.IsDocumentation())
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
367 {
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
368 call.GetDocumentation()
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
369 .SetTag("System")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
370 .SetSummary("Get default encoding")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
371 .SetDescription("Get the default encoding that is used by Orthanc if parsing "
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
372 "a DICOM instance without the `SpecificCharacterEncoding` tag, or during C-FIND. "
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
373 "This corresponds to the configuration option `DefaultEncoding`.")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
374 .AddAnswerType(MimeType_PlainText, "The name of the encoding");
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
375 return;
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
376 }
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
377
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
378 Encoding encoding = GetDefaultDicomEncoding();
2908
9d277f8ad698 new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2905
diff changeset
379 call.GetOutput().AnswerBuffer(EnumerationToString(encoding), MimeType_PlainText);
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
380 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
381
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
382
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
383 static void SetDefaultEncoding(RestApiPutCall& call)
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
384 {
4403
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
385 if (call.IsDocumentation())
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
386 {
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
387 call.GetDocumentation()
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
388 .SetTag("System")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
389 .SetSummary("Set default encoding")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
390 .SetDescription("Change the default encoding that is used by Orthanc if parsing "
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
391 "a DICOM instance without the `SpecificCharacterEncoding` tag, or during C-FIND. "
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
392 "This corresponds to the configuration option `DefaultEncoding`.")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
393 .AddRequestType(MimeType_PlainText, "The name of the encoding. Check out configuration "
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
394 "option `DefaultEncoding` for the allowed values.");
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
395 return;
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
396 }
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
397
3401
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
398 std::string body;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
399 call.BodyToString(body);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
400
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
401 Encoding encoding = StringToEncoding(body.c_str());
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
402
2940
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2908
diff changeset
403 {
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2908
diff changeset
404 OrthancConfiguration::WriterLock lock;
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2908
diff changeset
405 lock.GetConfiguration().SetDefaultEncoding(encoding);
4767d36679ed refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2908
diff changeset
406 }
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
407
2908
9d277f8ad698 new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2905
diff changeset
408 call.GetOutput().AnswerBuffer(EnumerationToString(encoding), MimeType_PlainText);
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
409 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
410
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
411
4473
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
412 static void AnswerAcceptedTransferSyntaxes(RestApiCall& call)
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
413 {
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
414 std::set<DicomTransferSyntax> syntaxes;
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
415 OrthancRestApi::GetContext(call).GetAcceptedTransferSyntaxes(syntaxes);
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
416
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
417 Json::Value json = Json::arrayValue;
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
418 for (std::set<DicomTransferSyntax>::const_iterator
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
419 syntax = syntaxes.begin(); syntax != syntaxes.end(); ++syntax)
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
420 {
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
421 json.append(GetTransferSyntaxUid(*syntax));
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
422 }
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
423
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
424 call.GetOutput().AnswerJson(json);
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
425 }
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
426
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
427
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
428 static void GetAcceptedTransferSyntaxes(RestApiGetCall& call)
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
429 {
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
430 if (call.IsDocumentation())
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
431 {
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
432 call.GetDocumentation()
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
433 .SetTag("System")
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
434 .SetSummary("Get accepted transfer syntaxes")
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
435 .SetDescription("Get the list of UIDs of the DICOM transfer syntaxes that are accepted "
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
436 "by Orthanc C-STORE SCP. This corresponds to the configuration options "
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
437 "`AcceptedTransferSyntaxes` and `XXXTransferSyntaxAccepted`.")
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
438 .AddAnswerType(MimeType_Json, "JSON array containing the transfer syntax UIDs");
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
439 return;
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
440 }
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
441
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
442 AnswerAcceptedTransferSyntaxes(call);
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
443 }
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
444
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
445
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
446 static void SetAcceptedTransferSyntaxes(RestApiPutCall& call)
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
447 {
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
448 if (call.IsDocumentation())
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
449 {
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
450 call.GetDocumentation()
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
451 .SetTag("System")
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
452 .SetSummary("Set accepted transfer syntaxes")
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
453 .SetDescription("Set the DICOM transfer syntaxes that accepted by Orthanc C-STORE SCP")
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
454 .AddRequestType(MimeType_PlainText, "UID of the transfer syntax to be accepted. "
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
455 "Wildcards `?` and `*` are accepted.")
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
456 .AddRequestType(MimeType_Json, "JSON array containing a list of transfer syntax "
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
457 "UIDs to be accepted. Wildcards `?` and `*` are accepted.")
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
458 .AddAnswerType(MimeType_Json, "JSON array containing the now-accepted transfer syntax UIDs");
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
459 return;
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
460 }
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
461
4474
f8c1d94363b6 new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4473
diff changeset
462 std::set<DicomTransferSyntax> syntaxes;
4473
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
463
4474
f8c1d94363b6 new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4473
diff changeset
464 Json::Value json;
f8c1d94363b6 new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4473
diff changeset
465 if (call.ParseJsonRequest(json))
f8c1d94363b6 new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4473
diff changeset
466 {
f8c1d94363b6 new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4473
diff changeset
467 OrthancConfiguration::ParseAcceptedTransferSyntaxes(syntaxes, json);
f8c1d94363b6 new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4473
diff changeset
468 }
f8c1d94363b6 new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4473
diff changeset
469 else
f8c1d94363b6 new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4473
diff changeset
470 {
f8c1d94363b6 new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4473
diff changeset
471 std::string body;
f8c1d94363b6 new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4473
diff changeset
472 call.BodyToString(body);
f8c1d94363b6 new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4473
diff changeset
473 OrthancConfiguration::ParseAcceptedTransferSyntaxes(syntaxes, body);
f8c1d94363b6 new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4473
diff changeset
474 }
f8c1d94363b6 new configuration options: "AcceptedTransferSyntaxes" and "H265TransferSyntaxAccepted"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4473
diff changeset
475
4473
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
476 OrthancRestApi::GetContext(call).SetAcceptedTransferSyntaxes(syntaxes);
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
477
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
478 AnswerAcceptedTransferSyntaxes(call);
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
479 }
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
480
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
481
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
482 static void GetUnknownSopClassAccepted(RestApiGetCall& call)
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
483 {
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
484 if (call.IsDocumentation())
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
485 {
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
486 call.GetDocumentation()
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
487 .SetTag("System")
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
488 .SetSummary("Is unknown SOP class accepted?")
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
489 .SetDescription("Shall Orthanc C-STORE SCP accept DICOM instances with an unknown SOP class UID?")
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
490 .AddAnswerType(MimeType_PlainText, "`1` if accepted, `0` if not accepted");
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
491 return;
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
492 }
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
493
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
494 const bool accepted = OrthancRestApi::GetContext(call).IsUnknownSopClassAccepted();
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
495 call.GetOutput().AnswerBuffer(accepted ? "1" : "0", MimeType_PlainText);
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
496 }
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
497
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
498
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
499 static void SetUnknownSopClassAccepted(RestApiPutCall& call)
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
500 {
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
501 if (call.IsDocumentation())
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
502 {
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
503 call.GetDocumentation()
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
504 .SetTag("System")
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
505 .SetSummary("Set unknown SOP class accepted")
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
506 .SetDescription("Set whether Orthanc C-STORE SCP should accept DICOM instances with an unknown SOP class UID")
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
507 .AddRequestType(MimeType_PlainText, "`1` if accepted, `0` if not accepted");
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
508 return;
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
509 }
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
510
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
511 OrthancRestApi::GetContext(call).SetUnknownSopClassAccepted(call.ParseBooleanBody());
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
512 call.GetOutput().AnswerBuffer("", MimeType_PlainText);
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
513 }
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
514
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
515
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
516
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
517 // Plugins information ------------------------------------------------------
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
518
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
519 static void ListPlugins(RestApiGetCall& call)
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
520 {
4417
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
521 if (call.IsDocumentation())
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
522 {
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
523 call.GetDocumentation()
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
524 .SetTag("System")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
525 .SetSummary("List plugins")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
526 .SetDescription("List all the installed plugins")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
527 .AddAnswerType(MimeType_Json, "JSON array containing the identifiers of the installed plugins")
5432
59e3b6f8c5be migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5431
diff changeset
528 .SetHttpGetSample("https://orthanc.uclouvain.be/demo/plugins", true);
4417
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
529 return;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
530 }
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
531
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
532 Json::Value v = Json::arrayValue;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
533
1233
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
534 v.append("explorer.js");
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
535
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
536 if (OrthancRestApi::GetContext(call).HasPlugins())
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
537 {
2136
dd609a99d39a uniformization of the macro naming
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2069
diff changeset
538 #if ORTHANC_ENABLE_PLUGINS == 1
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
539 std::list<std::string> plugins;
1434
f9cd40166269 refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1433
diff changeset
540 OrthancRestApi::GetContext(call).GetPlugins().GetManager().ListPlugins(plugins);
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
541
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
542 for (std::list<std::string>::const_iterator
1303
bba8a47922d1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
543 it = plugins.begin(); it != plugins.end(); ++it)
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
544 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
545 v.append(*it);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
546 }
1632
eb8fbcf008b5 fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1631
diff changeset
547 #endif
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
548 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
549
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
550 call.GetOutput().AnswerJson(v);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
551 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
552
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
553
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
554 static void GetPlugin(RestApiGetCall& call)
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
555 {
4417
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
556 if (call.IsDocumentation())
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
557 {
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
558 call.GetDocumentation()
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
559 .SetTag("System")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
560 .SetSummary("Get plugin")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
561 .SetDescription("Get system information about the plugin whose identifier is provided in the URL")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
562 .SetUriArgument("id", "Identifier of the job of interest")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
563 .AddAnswerType(MimeType_Json, "JSON object containing information about the plugin")
5432
59e3b6f8c5be migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5431
diff changeset
564 .SetHttpGetSample("https://orthanc.uclouvain.be/demo/plugins/dicom-web", true);
4417
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
565 return;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
566 }
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
567
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
568 if (!OrthancRestApi::GetContext(call).HasPlugins())
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
569 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
570 return;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
571 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
572
2136
dd609a99d39a uniformization of the macro naming
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2069
diff changeset
573 #if ORTHANC_ENABLE_PLUGINS == 1
1434
f9cd40166269 refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1433
diff changeset
574 const PluginsManager& manager = OrthancRestApi::GetContext(call).GetPlugins().GetManager();
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
575 std::string id = call.GetUriComponent("id", "");
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
576
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
577 if (manager.HasPlugin(id))
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
578 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
579 Json::Value v = Json::objectValue;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
580 v["ID"] = id;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
581 v["Version"] = manager.GetPluginVersion(id);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
582
1434
f9cd40166269 refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1433
diff changeset
583 const OrthancPlugins& plugins = OrthancRestApi::GetContext(call).GetPlugins();
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
584 const char *c = plugins.GetProperty(id.c_str(), _OrthancPluginProperty_RootUri);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
585 if (c != NULL)
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
586 {
1597
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
587 std::string root = c;
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
588 if (!root.empty())
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
589 {
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
590 // Turn the root URI into a URI relative to "/app/explorer.js"
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
591 if (root[0] == '/')
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
592 {
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
593 root = ".." + root;
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
594 }
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
595
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
596 v["RootUri"] = root;
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
597 }
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
598 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
599
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
600 c = plugins.GetProperty(id.c_str(), _OrthancPluginProperty_Description);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
601 if (c != NULL)
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
602 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
603 v["Description"] = c;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
604 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
605
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
606 c = plugins.GetProperty(id.c_str(), _OrthancPluginProperty_OrthancExplorer);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
607 v["ExtendsOrthancExplorer"] = (c != NULL);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
608
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
609 call.GetOutput().AnswerJson(v);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
610 }
1632
eb8fbcf008b5 fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1631
diff changeset
611 #endif
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
612 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
613
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
614
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
615 static void GetOrthancExplorerPlugins(RestApiGetCall& call)
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
616 {
4418
9d6fa3da8f00 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4417
diff changeset
617 if (call.IsDocumentation())
9d6fa3da8f00 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4417
diff changeset
618 {
9d6fa3da8f00 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4417
diff changeset
619 call.GetDocumentation()
9d6fa3da8f00 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4417
diff changeset
620 .SetTag("System")
9d6fa3da8f00 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4417
diff changeset
621 .SetSummary("JavaScript extensions to Orthanc Explorer")
9d6fa3da8f00 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4417
diff changeset
622 .SetDescription("Get the JavaScript extensions that are installed by all the plugins using the "
9d6fa3da8f00 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4417
diff changeset
623 "`OrthancPluginExtendOrthancExplorer()` function of the plugin SDK. "
9d6fa3da8f00 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4417
diff changeset
624 "This route is for internal use of Orthanc Explorer.")
9d6fa3da8f00 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4417
diff changeset
625 .AddAnswerType(MimeType_JavaScript, "The JavaScript extensions");
9d6fa3da8f00 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4417
diff changeset
626 return;
9d6fa3da8f00 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4417
diff changeset
627 }
9d6fa3da8f00 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4417
diff changeset
628
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
629 std::string s = "// Extensions to Orthanc Explorer by the registered plugins\n\n";
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
630
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
631 if (OrthancRestApi::GetContext(call).HasPlugins())
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
632 {
2136
dd609a99d39a uniformization of the macro naming
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2069
diff changeset
633 #if ORTHANC_ENABLE_PLUGINS == 1
1434
f9cd40166269 refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1433
diff changeset
634 const OrthancPlugins& plugins = OrthancRestApi::GetContext(call).GetPlugins();
f9cd40166269 refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1433
diff changeset
635 const PluginsManager& manager = plugins.GetManager();
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
636
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
637 std::list<std::string> lst;
1434
f9cd40166269 refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1433
diff changeset
638 manager.ListPlugins(lst);
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
639
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
640 for (std::list<std::string>::const_iterator
1303
bba8a47922d1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
641 it = lst.begin(); it != lst.end(); ++it)
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
642 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
643 const char* tmp = plugins.GetProperty(it->c_str(), _OrthancPluginProperty_OrthancExplorer);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
644 if (tmp != NULL)
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
645 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
646 s += "/**\n * From plugin: " + *it + " (version " + manager.GetPluginVersion(*it) + ")\n **/\n\n";
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
647 s += std::string(tmp) + "\n\n";
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
648 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
649 }
1632
eb8fbcf008b5 fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1631
diff changeset
650 #endif
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
651 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
652
2908
9d277f8ad698 new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2905
diff changeset
653 call.GetOutput().AnswerBuffer(s, MimeType_JavaScript);
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
654 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
655
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
656
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2140
diff changeset
657
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2140
diff changeset
658
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
659 // Jobs information ------------------------------------------------------
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
660
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
661 static void ListJobs(RestApiGetCall& call)
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2140
diff changeset
662 {
4417
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
663 if (call.IsDocumentation())
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
664 {
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
665 call.GetDocumentation()
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
666 .SetTag("Jobs")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
667 .SetSummary("List jobs")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
668 .SetDescription("List all the available jobs")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
669 .SetHttpGetArgument("expand", RestApiCallDocumentation::Type_String,
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
670 "If present, retrieve detailed information about the individual jobs", false)
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
671 .AddAnswerType(MimeType_Json, "JSON array containing either the jobs identifiers, or detailed information "
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
672 "about the reported jobs (if `expand` argument is provided)")
5432
59e3b6f8c5be migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5431
diff changeset
673 .SetTruncatedJsonHttpGetSample("https://orthanc.uclouvain.be/demo/jobs", 3);
4417
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
674 return;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
675 }
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
676
5405
62bb63346185 All 'expand' GET arguments now accepts expand=true and expand=false values + /studies/../instances now supports expand=false
Alain Mazy <am@osimis.io>
parents: 5364
diff changeset
677 bool expand = call.HasArgument("expand") && call.GetBooleanArgument("expand", true);
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
678
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
679 Json::Value v = Json::arrayValue;
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
680
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
681 std::set<std::string> jobs;
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
682 OrthancRestApi::GetContext(call).GetJobsEngine().GetRegistry().ListJobs(jobs);
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2140
diff changeset
683
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
684 for (std::set<std::string>::const_iterator it = jobs.begin();
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
685 it != jobs.end(); ++it)
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
686 {
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
687 if (expand)
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
688 {
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
689 JobInfo info;
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
690 if (OrthancRestApi::GetContext(call).GetJobsEngine().GetRegistry().GetJobInfo(info, *it))
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
691 {
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
692 Json::Value tmp;
2647
73d7d95dd75e removal of internal job information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2617
diff changeset
693 info.Format(tmp);
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
694 v.append(tmp);
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
695 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
696 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
697 else
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
698 {
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
699 v.append(*it);
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
700 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
701 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
702
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
703 call.GetOutput().AnswerJson(v);
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2140
diff changeset
704 }
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2140
diff changeset
705
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
706 static void GetJobInfo(RestApiGetCall& call)
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
707 {
4417
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
708 if (call.IsDocumentation())
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
709 {
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
710 Json::Value sample;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
711 sample["CompletionTime"] = "20201227T161842.520129";
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
712 sample["Content"]["ArchiveSizeMB"] = 22;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
713 sample["Content"]["Description"] = "REST API";
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
714 sample["Content"]["InstancesCount"] = 232;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
715 sample["Content"]["UncompressedSizeMB"] = 64;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
716 sample["CreationTime"] = "20201227T161836.428311";
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
717 sample["EffectiveRuntime"] = 6.0810000000000004;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
718 sample["ErrorCode"] = 0;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
719 sample["ErrorDescription"] = "Success";
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
720 sample["ID"] = "645ecb02-7c0e-4465-b767-df873222dcfb";
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
721 sample["Priority"] = 0;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
722 sample["Progress"] = 100;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
723 sample["State"] = "Success";
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
724 sample["Timestamp"] = "20201228T160340.253201";
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
725 sample["Type"] = "Media";
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
726
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
727 call.GetDocumentation()
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
728 .SetTag("Jobs")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
729 .SetSummary("Get job")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
730 .SetDescription("Retrieve detailed information about the job whose identifier is provided in the URL: "
5432
59e3b6f8c5be migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5431
diff changeset
731 "https://orthanc.uclouvain.be/book/users/advanced-rest.html#jobs")
4417
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
732 .SetUriArgument("id", "Identifier of the job of interest")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
733 .AddAnswerType(MimeType_Json, "JSON object detailing the job")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
734 .SetSample(sample);
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
735 return;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
736 }
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
737
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
738 std::string id = call.GetUriComponent("id", "");
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2140
diff changeset
739
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
740 JobInfo info;
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
741 if (OrthancRestApi::GetContext(call).GetJobsEngine().GetRegistry().GetJobInfo(info, id))
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
742 {
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
743 Json::Value json;
2647
73d7d95dd75e removal of internal job information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2617
diff changeset
744 info.Format(json);
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
745 call.GetOutput().AnswerJson(json);
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
746 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
747 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
748
5364
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
749 static void DeleteJobInfo(RestApiDeleteCall& call)
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
750 {
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
751 if (call.IsDocumentation())
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
752 {
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
753 call.GetDocumentation()
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
754 .SetTag("Jobs")
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
755 .SetSummary("Delete a job from history")
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
756 .SetDescription("Delete the job from the jobs history. Only a completed job can be deleted. "
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
757 "If the job has not run or not completed yet, you must cancel it first. "
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
758 "If the job has outputs, all outputs will be deleted as well. ")
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
759 .SetUriArgument("id", "Identifier of the job of interest");
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
760 return;
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
761 }
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
762
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
763 std::string job = call.GetUriComponent("id", "");
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
764
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
765 if (OrthancRestApi::GetContext(call).GetJobsEngine().
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
766 GetRegistry().DeleteJobInfo(job))
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
767 {
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
768 call.GetOutput().AnswerBuffer("", MimeType_PlainText);
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
769 }
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
770 else
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
771 {
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
772 throw OrthancException(ErrorCode_InexistentItem,
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
773 "No job found with this id: " + job);
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
774 }
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
775 }
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
776
2582
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
777
2976
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
778 static void GetJobOutput(RestApiGetCall& call)
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
779 {
4417
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
780 if (call.IsDocumentation())
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
781 {
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
782 call.GetDocumentation()
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
783 .SetTag("Jobs")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
784 .SetSummary("Get job output")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
785 .SetDescription("Retrieve some output produced by a job. As of Orthanc 1.8.2, only the jobs that generate a "
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
786 "DICOMDIR media or a ZIP archive provide such an output (with `key` equals to `archive`).")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
787 .SetUriArgument("id", "Identifier of the job of interest")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
788 .SetUriArgument("key", "Name of the output of interest")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
789 .AddAnswerType(MimeType_Binary, "Content of the output of the job");
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
790 return;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
791 }
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
792
2976
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
793 std::string job = call.GetUriComponent("id", "");
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
794 std::string key = call.GetUriComponent("key", "");
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
795
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
796 std::string value;
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
797 MimeType mime;
4805
0a38000b086d Archive jobs response now contains a header Content-Disposition:filename='archive.zip'
Alain Mazy <am@osimis.io>
parents: 4730
diff changeset
798 std::string filename;
2976
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
799
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
800 if (OrthancRestApi::GetContext(call).GetJobsEngine().
4805
0a38000b086d Archive jobs response now contains a header Content-Disposition:filename='archive.zip'
Alain Mazy <am@osimis.io>
parents: 4730
diff changeset
801 GetRegistry().GetJobOutput(value, mime, filename, job, key))
2976
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
802 {
4805
0a38000b086d Archive jobs response now contains a header Content-Disposition:filename='archive.zip'
Alain Mazy <am@osimis.io>
parents: 4730
diff changeset
803 if (!filename.empty())
0a38000b086d Archive jobs response now contains a header Content-Disposition:filename='archive.zip'
Alain Mazy <am@osimis.io>
parents: 4730
diff changeset
804 {
0a38000b086d Archive jobs response now contains a header Content-Disposition:filename='archive.zip'
Alain Mazy <am@osimis.io>
parents: 4730
diff changeset
805 call.GetOutput().SetContentFilename(filename.c_str());
0a38000b086d Archive jobs response now contains a header Content-Disposition:filename='archive.zip'
Alain Mazy <am@osimis.io>
parents: 4730
diff changeset
806 }
0a38000b086d Archive jobs response now contains a header Content-Disposition:filename='archive.zip'
Alain Mazy <am@osimis.io>
parents: 4730
diff changeset
807
2976
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
808 call.GetOutput().AnswerBuffer(value, mime);
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
809 }
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
810 else
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
811 {
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
812 throw OrthancException(ErrorCode_InexistentItem,
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
813 "Job has no such output: " + key);
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
814 }
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
815 }
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
816
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
817
5310
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
818 static void DeleteJobOutput(RestApiDeleteCall& call)
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
819 {
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
820 if (call.IsDocumentation())
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
821 {
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
822 call.GetDocumentation()
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
823 .SetTag("Jobs")
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
824 .SetSummary("Delete a job output")
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
825 .SetDescription("Delete the output produced by a job. As of Orthanc 1.12.1, only the jobs that generate a "
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
826 "DICOMDIR media or a ZIP archive provide such an output (with `key` equals to `archive`).")
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
827 .SetUriArgument("id", "Identifier of the job of interest")
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
828 .SetUriArgument("key", "Name of the output of interest");
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
829 return;
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
830 }
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
831
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
832 std::string job = call.GetUriComponent("id", "");
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
833 std::string key = call.GetUriComponent("key", "");
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
834
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
835 if (OrthancRestApi::GetContext(call).GetJobsEngine().
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
836 GetRegistry().DeleteJobOutput(job, key))
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
837 {
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
838 call.GetOutput().AnswerBuffer("", MimeType_PlainText);
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
839 }
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
840 else
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
841 {
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
842 throw OrthancException(ErrorCode_InexistentItem,
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
843 "Job has no such output: " + key);
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
844 }
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
845 }
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
846
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
847
2582
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
848 enum JobAction
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
849 {
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
850 JobAction_Cancel,
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
851 JobAction_Pause,
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
852 JobAction_Resubmit,
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
853 JobAction_Resume
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
854 };
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
855
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
856 template <JobAction action>
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
857 static void ApplyJobAction(RestApiPostCall& call)
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
858 {
4417
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
859 if (call.IsDocumentation())
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
860 {
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
861 std::string verb;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
862 switch (action)
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
863 {
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
864 case JobAction_Cancel:
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
865 verb = "Cancel";
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
866 break;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
867
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
868 case JobAction_Pause:
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
869 verb = "Pause";
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
870 break;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
871
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
872 case JobAction_Resubmit:
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
873 verb = "Resubmit";
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
874 break;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
875
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
876 case JobAction_Resume:
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
877 verb = "Resume";
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
878 break;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
879
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
880 default:
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
881 throw OrthancException(ErrorCode_InternalError);
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
882 }
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
883
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
884 call.GetDocumentation()
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
885 .SetTag("Jobs")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
886 .SetSummary(verb + " job")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
887 .SetDescription(verb + " the job whose identifier is provided in the URL. Check out the "
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
888 "Orthanc Book for more information about the state machine applicable to jobs: "
5432
59e3b6f8c5be migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5431
diff changeset
889 "https://orthanc.uclouvain.be/book/users/advanced-rest.html#jobs")
4417
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
890 .SetUriArgument("id", "Identifier of the job of interest")
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
891 .AddAnswerType(MimeType_Json, "Empty JSON object in the case of a success");
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
892 return;
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
893 }
a4518adede59 openapi for plugins and jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4403
diff changeset
894
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
895 std::string id = call.GetUriComponent("id", "");
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
896
2582
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
897 bool ok = false;
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
898
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
899 switch (action)
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
900 {
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
901 case JobAction_Cancel:
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
902 ok = OrthancRestApi::GetContext(call).GetJobsEngine().GetRegistry().Cancel(id);
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
903 break;
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
904
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
905 case JobAction_Pause:
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
906 ok = OrthancRestApi::GetContext(call).GetJobsEngine().GetRegistry().Pause(id);
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
907 break;
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
908
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
909 case JobAction_Resubmit:
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
910 ok = OrthancRestApi::GetContext(call).GetJobsEngine().GetRegistry().Resubmit(id);
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
911 break;
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
912
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
913 case JobAction_Resume:
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
914 ok = OrthancRestApi::GetContext(call).GetJobsEngine().GetRegistry().Resume(id);
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
915 break;
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
916
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
917 default:
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
918 throw OrthancException(ErrorCode_InternalError);
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
919 }
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
920
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
921 if (ok)
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
922 {
2908
9d277f8ad698 new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2905
diff changeset
923 call.GetOutput().AnswerBuffer("{}", MimeType_Json);
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
924 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
925 }
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
926
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
927
3174
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
928 static void GetMetricsPrometheus(RestApiGetCall& call)
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
929 {
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
930 if (call.IsDocumentation())
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
931 {
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
932 call.GetDocumentation()
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
933 .SetTag("System")
4403
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
934 .SetSummary("Get usage metrics")
4424
83371ccdfe80 openapi documentation is now completed
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4418
diff changeset
935 .SetDescription("Get usage metrics of Orthanc in the Prometheus file format (OpenMetrics): "
5432
59e3b6f8c5be migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5431
diff changeset
936 "https://orthanc.uclouvain.be/book/users/advanced-rest.html#instrumentation-with-prometheus")
59e3b6f8c5be migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5431
diff changeset
937 .SetHttpGetSample("https://orthanc.uclouvain.be/demo/tools/metrics-prometheus", false);
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
938 return;
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
939 }
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
940
3179
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3177
diff changeset
941 #if ORTHANC_ENABLE_PLUGINS == 1
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3177
diff changeset
942 OrthancRestApi::GetContext(call).GetPlugins().RefreshMetrics();
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3177
diff changeset
943 #endif
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3177
diff changeset
944
3177
053e72ff9fc5 new metrics: orthanc_jobs_[pending|running|completed]
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
945 static const float MEGA_BYTES = 1024 * 1024;
3174
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
946
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
947 ServerContext& context = OrthancRestApi::GetContext(call);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
948
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
949 uint64_t diskSize, uncompressedSize, countPatients, countStudies, countSeries, countInstances;
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
950 context.GetIndex().GetGlobalStatistics(diskSize, uncompressedSize, countPatients,
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
951 countStudies, countSeries, countInstances);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
952
3179
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3177
diff changeset
953 unsigned int jobsPending, jobsRunning, jobsSuccess, jobsFailed;
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3177
diff changeset
954 context.GetJobsEngine().GetRegistry().GetStatistics(jobsPending, jobsRunning, jobsSuccess, jobsFailed);
3177
053e72ff9fc5 new metrics: orthanc_jobs_[pending|running|completed]
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
955
5111
7547c7dfd017 /tools/metrics-prometheus: added orthanc_last_change and orthanc_up_time_s
Alain Mazy <am@osimis.io>
parents: 5024
diff changeset
956 int64_t serverUpTime = context.GetServerUpTime();
7547c7dfd017 /tools/metrics-prometheus: added orthanc_last_change and orthanc_up_time_s
Alain Mazy <am@osimis.io>
parents: 5024
diff changeset
957 Json::Value lastChange;
7547c7dfd017 /tools/metrics-prometheus: added orthanc_last_change and orthanc_up_time_s
Alain Mazy <am@osimis.io>
parents: 5024
diff changeset
958 context.GetIndex().GetLastChange(lastChange);
7547c7dfd017 /tools/metrics-prometheus: added orthanc_last_change and orthanc_up_time_s
Alain Mazy <am@osimis.io>
parents: 5024
diff changeset
959
3177
053e72ff9fc5 new metrics: orthanc_jobs_[pending|running|completed]
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3174
diff changeset
960 MetricsRegistry& registry = context.GetMetricsRegistry();
5337
b376abae664a Metrics can be stored either as floating-point numbers, or as integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5330
diff changeset
961 registry.SetFloatValue("orthanc_disk_size_mb", static_cast<float>(diskSize) / MEGA_BYTES);
b376abae664a Metrics can be stored either as floating-point numbers, or as integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5330
diff changeset
962 registry.SetFloatValue("orthanc_uncompressed_size_mb", static_cast<float>(diskSize) / MEGA_BYTES);
b376abae664a Metrics can be stored either as floating-point numbers, or as integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5330
diff changeset
963 registry.SetIntegerValue("orthanc_count_patients", static_cast<int64_t>(countPatients));
b376abae664a Metrics can be stored either as floating-point numbers, or as integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5330
diff changeset
964 registry.SetIntegerValue("orthanc_count_studies", static_cast<int64_t>(countStudies));
b376abae664a Metrics can be stored either as floating-point numbers, or as integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5330
diff changeset
965 registry.SetIntegerValue("orthanc_count_series", static_cast<int64_t>(countSeries));
b376abae664a Metrics can be stored either as floating-point numbers, or as integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5330
diff changeset
966 registry.SetIntegerValue("orthanc_count_instances", static_cast<int64_t>(countInstances));
b376abae664a Metrics can be stored either as floating-point numbers, or as integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5330
diff changeset
967 registry.SetIntegerValue("orthanc_jobs_pending", jobsPending);
b376abae664a Metrics can be stored either as floating-point numbers, or as integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5330
diff changeset
968 registry.SetIntegerValue("orthanc_jobs_running", jobsRunning);
b376abae664a Metrics can be stored either as floating-point numbers, or as integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5330
diff changeset
969 registry.SetIntegerValue("orthanc_jobs_completed", jobsSuccess + jobsFailed);
b376abae664a Metrics can be stored either as floating-point numbers, or as integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5330
diff changeset
970 registry.SetIntegerValue("orthanc_jobs_success", jobsSuccess);
b376abae664a Metrics can be stored either as floating-point numbers, or as integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5330
diff changeset
971 registry.SetIntegerValue("orthanc_jobs_failed", jobsFailed);
b376abae664a Metrics can be stored either as floating-point numbers, or as integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5330
diff changeset
972 registry.SetIntegerValue("orthanc_up_time_s", serverUpTime);
b376abae664a Metrics can be stored either as floating-point numbers, or as integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5330
diff changeset
973 registry.SetIntegerValue("orthanc_last_change", lastChange["Last"].asInt64());
5111
7547c7dfd017 /tools/metrics-prometheus: added orthanc_last_change and orthanc_up_time_s
Alain Mazy <am@osimis.io>
parents: 5024
diff changeset
974
5431
4be5f117aa0d metrics
Alain Mazy <am@osimis.io>
parents: 5405
diff changeset
975 context.PublishCacheMetrics();
4be5f117aa0d metrics
Alain Mazy <am@osimis.io>
parents: 5405
diff changeset
976
3174
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
977 std::string s;
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
978 registry.ExportPrometheusText(s);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
979
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
980 call.GetOutput().AnswerBuffer(s, MimeType_PrometheusText);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
981 }
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
982
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
983
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
984 static void GetMetricsEnabled(RestApiGetCall& call)
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
985 {
4403
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
986 if (call.IsDocumentation())
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
987 {
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
988 call.GetDocumentation()
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
989 .SetTag("System")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
990 .SetSummary("Are metrics collected?")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
991 .SetDescription("Returns a Boolean specifying whether Prometheus metrics "
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
992 "are collected and exposed at `/tools/metrics-prometheus`")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
993 .AddAnswerType(MimeType_PlainText, "`1` if metrics are collected, `0` if metrics are disabled");
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
994 return;
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
995 }
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
996
3174
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
997 bool enabled = OrthancRestApi::GetContext(call).GetMetricsRegistry().IsEnabled();
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
998 call.GetOutput().AnswerBuffer(enabled ? "1" : "0", MimeType_PlainText);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
999 }
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
1000
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
1001
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
1002 static void PutMetricsEnabled(RestApiPutCall& call)
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
1003 {
4403
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1004 if (call.IsDocumentation())
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1005 {
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1006 call.GetDocumentation()
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1007 .SetTag("System")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1008 .SetSummary("Enable collection of metrics")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1009 .SetDescription("Enable or disable the collection and publication of metrics at `/tools/metrics-prometheus`")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1010 .AddRequestType(MimeType_PlainText, "`1` if metrics are collected, `0` if metrics are disabled");
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1011 return;
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1012 }
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1013
4473
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
1014 const bool enabled = call.ParseBooleanBody();
3174
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
1015
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
1016 // Success
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
1017 OrthancRestApi::GetContext(call).GetMetricsRegistry().SetEnabled(enabled);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
1018 call.GetOutput().AnswerBuffer("", MimeType_PlainText);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
1019 }
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
1020
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
1021
3672
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1022 static void GetLogLevel(RestApiGetCall& call)
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1023 {
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1024 if (call.IsDocumentation())
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1025 {
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1026 call.GetDocumentation()
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1027 .SetTag("Logs")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1028 .SetSummary("Get main log level")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1029 .SetDescription("Get the main log level of Orthanc")
4403
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1030 .AddAnswerType(MimeType_PlainText, "Possible values: `default`, `verbose` or `trace`");
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1031 return;
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1032 }
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1033
4273
0034f855c023 tuning log categories from command-line, and binary compat with orthanc framework 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4143
diff changeset
1034 const std::string s = EnumerationToString(GetGlobalVerbosity());
3672
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1035 call.GetOutput().AnswerBuffer(s, MimeType_PlainText);
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1036 }
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1037
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1038
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1039 static void PutLogLevel(RestApiPutCall& call)
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1040 {
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1041 if (call.IsDocumentation())
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1042 {
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1043 call.GetDocumentation()
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1044 .SetTag("Logs")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1045 .SetSummary("Set main log level")
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1046 .SetDescription("Set the main log level of Orthanc")
4403
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1047 .AddRequestType(MimeType_PlainText, "Possible values: `default`, `verbose` or `trace`");
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1048 return;
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1049 }
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1050
3672
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1051 std::string body;
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1052 call.BodyToString(body);
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1053
4273
0034f855c023 tuning log categories from command-line, and binary compat with orthanc framework 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4143
diff changeset
1054 SetGlobalVerbosity(StringToVerbosity(body));
0034f855c023 tuning log categories from command-line, and binary compat with orthanc framework 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4143
diff changeset
1055
3672
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1056 // Success
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1057 LOG(WARNING) << "REST API call has switched the log level to: " << body;
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1058 call.GetOutput().AnswerBuffer("", MimeType_PlainText);
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1059 }
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1060
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1061
4275
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1062 static Logging::LogCategory GetCategory(const RestApiCall& call)
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1063 {
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1064 static const std::string PREFIX = "log-level-";
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1065
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1066 if (call.GetFullUri().size() == 2 &&
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1067 call.GetFullUri() [0] == "tools" &&
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1068 boost::starts_with(call.GetFullUri() [1], PREFIX))
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1069 {
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1070 Logging::LogCategory category;
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1071 if (Logging::LookupCategory(category, call.GetFullUri() [1].substr(PREFIX.size())))
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1072 {
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1073 return category;
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1074 }
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1075 }
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1076
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1077 throw OrthancException(ErrorCode_InternalError);
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1078 }
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1079
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1080
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1081 static void GetLogLevelCategory(RestApiGetCall& call)
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1082 {
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1083 if (call.IsDocumentation())
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1084 {
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1085 std::string category = Logging::GetCategoryName(GetCategory(call));
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1086 call.GetDocumentation()
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1087 .SetTag("Logs")
4403
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1088 .SetSummary("Get log level for `" + category + "`")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1089 .SetDescription("Get the log level of the log category `" + category + "`")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1090 .AddAnswerType(MimeType_PlainText, "Possible values: `default`, `verbose` or `trace`");
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1091 return;
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1092 }
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1093
4275
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1094 const std::string s = EnumerationToString(GetCategoryVerbosity(GetCategory(call)));
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1095 call.GetOutput().AnswerBuffer(s, MimeType_PlainText);
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1096 }
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1097
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1098
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1099 static void PutLogLevelCategory(RestApiPutCall& call)
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1100 {
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1101 if (call.IsDocumentation())
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1102 {
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1103 std::string category = Logging::GetCategoryName(GetCategory(call));
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1104 call.GetDocumentation()
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1105 .SetTag("Logs")
4403
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1106 .SetSummary("Set log level for `" + category + "`")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1107 .SetDescription("Set the log level of the log category `" + category + "`")
ad646ff506d0 cont openapi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4401
diff changeset
1108 .AddRequestType(MimeType_PlainText, "Possible values: `default`, `verbose` or `trace`");
4401
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1109 return;
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1110 }
354ea95b294a documenting system calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4379
diff changeset
1111
4275
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1112 std::string body;
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1113 call.BodyToString(body);
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1114
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1115 Verbosity verbosity = StringToVerbosity(body);
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1116 Logging::LogCategory category = GetCategory(call);
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1117 SetCategoryVerbosity(category, verbosity);
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1118
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1119 // Success
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1120 LOG(WARNING) << "REST API call has switched the log level of category \""
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1121 << Logging::GetCategoryName(category) << "\" to \""
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1122 << EnumerationToString(verbosity) << "\"";
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1123 call.GetOutput().AnswerBuffer("", MimeType_PlainText);
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1124 }
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1125
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1126
5249
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1127 static void ListAllLabels(RestApiGetCall& call)
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1128 {
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1129 if (call.IsDocumentation())
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1130 {
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1131 call.GetDocumentation()
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1132 .SetTag("System")
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1133 .SetSummary("Get all the used labels")
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1134 .SetDescription("List all the labels that are associated with any resource of the Orthanc database")
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1135 .AddAnswerType(MimeType_Json, "JSON array containing the labels");
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1136 return;
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1137 }
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1138
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1139 std::set<std::string> labels;
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1140 OrthancRestApi::GetIndex(call).ListAllLabels(labels);
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1141
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1142 Json::Value json = Json::arrayValue;
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1143 for (std::set<std::string>::const_iterator it = labels.begin(); it != labels.end(); ++it)
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1144 {
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1145 json.append(*it);
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1146 }
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1147
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1148 call.GetOutput().AnswerJson(json);
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1149 }
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1150
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1151
4378
9e2fc6911ac8 adding option to disable orthance explorer when http server is enabled
Andrew Wallis <andrew.wallis@varian.com>>
parents: 4275
diff changeset
1152 void OrthancRestApi::RegisterSystem(bool orthancExplorerEnabled)
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1153 {
4378
9e2fc6911ac8 adding option to disable orthance explorer when http server is enabled
Andrew Wallis <andrew.wallis@varian.com>>
parents: 4275
diff changeset
1154 if (orthancExplorerEnabled)
9e2fc6911ac8 adding option to disable orthance explorer when http server is enabled
Andrew Wallis <andrew.wallis@varian.com>>
parents: 4275
diff changeset
1155 {
9e2fc6911ac8 adding option to disable orthance explorer when http server is enabled
Andrew Wallis <andrew.wallis@varian.com>>
parents: 4275
diff changeset
1156 Register("/", ServeRoot);
4461
22abc6851191 The DICOM meta-header and the transfer syntax are displayed at the "Instance" level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1157 Register("/favicon.ico", ServeFavicon); // New in Orthanc 1.9.0
4378
9e2fc6911ac8 adding option to disable orthance explorer when http server is enabled
Andrew Wallis <andrew.wallis@varian.com>>
parents: 4275
diff changeset
1158 }
4379
85b5b0e1bac9 added NEWS about "OrthancExplorerEnabled" option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4378
diff changeset
1159
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1160 Register("/system", GetSystemInformation);
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1161 Register("/statistics", GetStatistics);
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1162 Register("/tools/generate-uid", GenerateUid);
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1163 Register("/tools/execute-script", ExecuteScript);
2475
8cc3ca64a534 Orthanc now uses UTC (universal time) instead of local time in its database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
1164 Register("/tools/now", GetNowIsoString<true>);
8cc3ca64a534 Orthanc now uses UTC (universal time) instead of local time in its database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
1165 Register("/tools/now-local", GetNowIsoString<false>);
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
1166 Register("/tools/dicom-conformance", GetDicomConformanceStatement);
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2140
diff changeset
1167 Register("/tools/default-encoding", GetDefaultEncoding);
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2140
diff changeset
1168 Register("/tools/default-encoding", SetDefaultEncoding);
3174
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
1169 Register("/tools/metrics", GetMetricsEnabled);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
1170 Register("/tools/metrics", PutMetricsEnabled);
8ea7c4546c3a primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3097
diff changeset
1171 Register("/tools/metrics-prometheus", GetMetricsPrometheus);
3672
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1172 Register("/tools/log-level", GetLogLevel);
ea8c1c0e81eb Fix issue #65 (Logging improvements)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1173 Register("/tools/log-level", PutLogLevel);
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
1174
4275
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1175 for (size_t i = 0; i < Logging::GetCategoriesCount(); i++)
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1176 {
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1177 const std::string name(Logging::GetCategoryName(i));
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1178 Register("/tools/log-level-" + name, GetLogLevelCategory);
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1179 Register("/tools/log-level-" + name, PutLogLevelCategory);
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1180 }
d7a50b7b8466 Dynamically access and/or change the verbosity of logging categories with the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4273
diff changeset
1181
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
1182 Register("/plugins", ListPlugins);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
1183 Register("/plugins/{id}", GetPlugin);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
1184 Register("/plugins/explorer.js", GetOrthancExplorerPlugins);
2573
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
1185
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
1186 Register("/jobs", ListJobs);
3372c5255333 StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2475
diff changeset
1187 Register("/jobs/{id}", GetJobInfo);
5364
b5f2122a1334 Added a route to delete completed jobs from history: DELETE /jobs/{id}
Alain Mazy <am@osimis.io>
parents: 5337
diff changeset
1188 Register("/jobs/{id}", DeleteJobInfo);
2582
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1189 Register("/jobs/{id}/cancel", ApplyJobAction<JobAction_Cancel>);
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1190 Register("/jobs/{id}/pause", ApplyJobAction<JobAction_Pause>);
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1191 Register("/jobs/{id}/resubmit", ApplyJobAction<JobAction_Resubmit>);
b3da733d984c job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2573
diff changeset
1192 Register("/jobs/{id}/resume", ApplyJobAction<JobAction_Resume>);
2976
cb5d75143da0 Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2940
diff changeset
1193 Register("/jobs/{id}/{key}", GetJobOutput);
5310
b5c502bcaf99 added a route to DELETE /jobs/../archive
Alain Mazy <am@osimis.io>
parents: 5249
diff changeset
1194 Register("/jobs/{id}/{key}", DeleteJobOutput);
4473
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
1195
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
1196 // New in Orthanc 1.9.0
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
1197 Register("/tools/accepted-transfer-syntaxes", GetAcceptedTransferSyntaxes);
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
1198 Register("/tools/accepted-transfer-syntaxes", SetAcceptedTransferSyntaxes);
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
1199 Register("/tools/unknown-sop-class-accepted", GetUnknownSopClassAccepted);
68f52897c119 new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4461
diff changeset
1200 Register("/tools/unknown-sop-class-accepted", SetUnknownSopClassAccepted);
5249
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1201
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
1202 Register("/tools/labels", ListAllLabels); // New in Orthanc 1.12.0
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1203 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1204 }