# HG changeset patch # User Sebastien Jodogne # Date 1606988611 -3600 # Node ID 1263e727d048f22147d0332ab7aeefd48857570e # Parent 7707fa761b711b8384714cd58c0705ce10f63761 give access to the configuration of one single peer or modality diff -r 7707fa761b71 -r 1263e727d048 NEWS --- a/NEWS Wed Dec 02 11:01:59 2020 +0100 +++ b/NEWS Thu Dec 03 10:43:31 2020 +0100 @@ -11,7 +11,10 @@ REST API -------- +* API version upgraded to 9 * "/tools/log-level-*": Dynamically access and/or change the verbosity of logging categories +* "/peers/{id}/configuration": Get the configuration of one peer (cf. "/peers?expand") +* "/modalities/{id}/configuration": Get the configuration of one modality (cf. "/modalities?expand") Maintenance ----------- diff -r 7707fa761b71 -r 1263e727d048 OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp Wed Dec 02 11:01:59 2020 +0100 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp Thu Dec 03 10:43:31 2020 +0100 @@ -1200,6 +1200,25 @@ } } + static void GetPeerConfiguration(RestApiGetCall& call) + { + OrthancConfiguration::ReaderLock lock; + const std::string peer = call.GetUriComponent("id", ""); + + WebServiceParameters info; + if (lock.GetConfiguration().LookupOrthancPeer(info, peer)) + { + Json::Value answer; + info.FormatPublic(answer); + call.GetOutput().AnswerJson(answer); + } + else + { + throw OrthancException(ErrorCode_UnknownResource, + "No peer with symbolic name: " + peer); + } + } + // DICOM bridge ------------------------------------------------------------- static bool IsExistingModality(const OrthancRestApi::SetOfStrings& modalities, @@ -1294,6 +1313,21 @@ } + static void GetModalityConfiguration(RestApiGetCall& call) + { + const std::string modality = call.GetUriComponent("id", ""); + + Json::Value answer; + + { + OrthancConfiguration::ReaderLock lock; + lock.GetConfiguration().GetModalityUsingSymbolicName(modality).Serialize(answer, true /* force advanced format */); + } + + call.GetOutput().AnswerJson(answer); + } + + static void UpdatePeer(RestApiPutCall& call) { ServerContext& context = OrthancRestApi::GetContext(call); @@ -1616,6 +1650,7 @@ Register("/modalities/{id}/store", DicomStore); Register("/modalities/{id}/store-straight", DicomStoreStraight); // New in 1.6.1 Register("/modalities/{id}/move", DicomMove); + Register("/modalities/{id}/configuration", GetModalityConfiguration); // New in 1.8.1 // For Query/Retrieve Register("/modalities/{id}/query", DicomQuery); @@ -1643,6 +1678,7 @@ Register("/peers/{id}", DeletePeer); Register("/peers/{id}/store", PeerStore); Register("/peers/{id}/system", PeerSystem); + Register("/peers/{id}/configuration", GetPeerConfiguration); // New in 1.8.1 Register("/modalities/{id}/find-worklist", DicomFindWorklist);