# HG changeset patch # User Sebastien Jodogne # Date 1680510615 -7200 # Node ID 19e916dfc767d4954ab82ce0b0f2e5e5d230257b # Parent 27e6ec2811e3202afd8cf3c5a3013dc72c1bae9d# Parent 1fa3bfa86f8ed73d50579a3bc4504efcfbbfbd06 integration mainline->db-protobuf diff -r 27e6ec2811e3 -r 19e916dfc767 NEWS --- a/NEWS Mon Apr 03 10:29:45 2023 +0200 +++ b/NEWS Mon Apr 03 10:30:15 2023 +0200 @@ -1,6 +1,12 @@ Pending changes in the mainline =============================== +REST API +-------- + +* API version upgraded to 20 +* /system: added UserMetadata + Maintenance ----------- diff -r 27e6ec2811e3 -r 19e916dfc767 OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake --- a/OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake Mon Apr 03 10:29:45 2023 +0200 +++ b/OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake Mon Apr 03 10:30:15 2023 +0200 @@ -38,7 +38,7 @@ # Version of the Orthanc API, can be retrieved from "/system" URI in # order to check whether new URI endpoints are available even if using # the mainline version of Orthanc -set(ORTHANC_API_VERSION "19") +set(ORTHANC_API_VERSION "20") ##################################################################### diff -r 27e6ec2811e3 -r 19e916dfc767 OrthancFramework/Sources/EnumerationDictionary.h --- a/OrthancFramework/Sources/EnumerationDictionary.h Mon Apr 03 10:29:45 2023 +0200 +++ b/OrthancFramework/Sources/EnumerationDictionary.h Mon Apr 03 10:30:15 2023 +0200 @@ -105,5 +105,10 @@ return found->second; } } + + const std::map& GetAllEntries() const + { + return stringToEnumeration_; + } }; } diff -r 27e6ec2811e3 -r 19e916dfc767 OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp Mon Apr 03 10:29:45 2023 +0200 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp Mon Apr 03 10:30:15 2023 +0200 @@ -50,14 +50,23 @@ static void GetMainDicomTagsConfiguration(Json::Value& result) { - Json::Value v; - result["Patient"] = DicomMap::GetMainDicomTagsSignature(ResourceType_Patient); result["Study"] = DicomMap::GetMainDicomTagsSignature(ResourceType_Study); result["Series"] = DicomMap::GetMainDicomTagsSignature(ResourceType_Series); result["Instance"] = DicomMap::GetMainDicomTagsSignature(ResourceType_Instance); } + static void GetUserMetadataConfiguration(Json::Value& result) + { + std::map userMetadata; + Orthanc::GetRegisteredUserMetadata(userMetadata); + + for (std::map::const_iterator it = userMetadata.begin(); it != userMetadata.end(); ++it) + { + result[it->first] = it->second; + } + } + static void GetSystemInformation(RestApiGetCall& call) { static const char* const API_VERSION = "ApiVersion"; @@ -79,6 +88,7 @@ static const char* const INGEST_TRANSCODING = "IngestTranscoding"; static const char* const MAXIMUM_STORAGE_SIZE = "MaximumStorageSize"; static const char* const MAXIMUM_STORAGE_MODE = "MaximumStorageMode"; + static const char* const USER_METADATA = "UserMetadata"; if (call.IsDocumentation()) { @@ -119,6 +129,8 @@ "The configured MaximumStorageSize in MB (new in Orthanc 1.11.3)") .SetAnswerField(MAXIMUM_STORAGE_MODE, RestApiCallDocumentation::Type_String, "The configured MaximumStorageMode (new in Orthanc 1.11.3)") + .SetAnswerField(USER_METADATA, RestApiCallDocumentation::Type_JsonObject, + "The configured UserMetadata (new in Orthanc 1.12.0)") .SetHttpGetSample("https://demo.orthanc-server.com/system", true); return; } @@ -172,6 +184,9 @@ result[MAIN_DICOM_TAGS] = Json::objectValue; GetMainDicomTagsConfiguration(result[MAIN_DICOM_TAGS]); + result[USER_METADATA] = Json::objectValue; + GetUserMetadataConfiguration(result[USER_METADATA]); + call.GetOutput().AnswerJson(result); } diff -r 27e6ec2811e3 -r 19e916dfc767 OrthancServer/Sources/ServerEnumerations.cpp --- a/OrthancServer/Sources/ServerEnumerations.cpp Mon Apr 03 10:29:45 2023 +0200 +++ b/OrthancServer/Sources/ServerEnumerations.cpp Mon Apr 03 10:30:15 2023 +0200 @@ -112,6 +112,23 @@ return dictMetadataType_.Translate(str); } + void GetRegisteredUserMetadata(std::map& allEntries) + { + boost::mutex::scoped_lock lock(enumerationsMutex_); + + allEntries.clear(); + + std::map allEntriesTyped = dictMetadataType_.GetAllEntries(); + + for (std::map::const_iterator it = allEntriesTyped.begin(); it != allEntriesTyped.end(); ++it) + { + if (it->second >= MetadataType_StartUser) + { + allEntries[it->first] = it->second; + } + } + } + void RegisterUserContentType(int contentType, const std::string& name, const std::string& mime) diff -r 27e6ec2811e3 -r 19e916dfc767 OrthancServer/Sources/ServerEnumerations.h --- a/OrthancServer/Sources/ServerEnumerations.h Mon Apr 03 10:29:45 2023 +0200 +++ b/OrthancServer/Sources/ServerEnumerations.h Mon Apr 03 10:30:15 2023 +0200 @@ -216,6 +216,8 @@ std::string EnumerationToString(MetadataType type); + void GetRegisteredUserMetadata(std::map& allEntries); + void RegisterUserContentType(int contentType, const std::string& name, const std::string& mime); diff -r 27e6ec2811e3 -r 19e916dfc767 TODO --- a/TODO Mon Apr 03 10:29:45 2023 +0200 +++ b/TODO Mon Apr 03 10:30:15 2023 +0200 @@ -115,6 +115,10 @@ https://groups.google.com/g/orthanc-users/c/rDDusFG5Lco/m/TzTUjWXLAQAJ * allow filtering/ordering on the /jobs route: https://groups.google.com/g/orthanc-users/c/hsZ1jng5rIg/m/8xZL2C1VBgAJ +* Also implement a GET variant of /tools/create-archive + sibling routes + in which resources & transcode options are provided as get arguments. + https://groups.google.com/g/orthanc-users/c/PmaRZ609ztA/m/JdwXvIBKAQAJ + --------- Long-term