diff OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp @ 4460:6831de40acd9

New metadata automatically computed at the series level: "RemoteAET"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 20 Jan 2021 14:20:37 +0100
parents d9473bd5ed43
children 68f52897c119
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Wed Jan 20 13:30:54 2021 +0100
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Wed Jan 20 14:20:37 2021 +0100
@@ -1420,6 +1420,7 @@
 
   static void CheckValidResourceType(const RestApiCall& call)
   {
+    assert(!call.GetFullUri().empty());
     const std::string resourceType = call.GetFullUri() [0];
     StringToResourceType(resourceType.c_str());
   }
@@ -1444,12 +1445,13 @@
       return;
     }
 
-    CheckValidResourceType(call);
-    
-    std::string publicId = call.GetUriComponent("id", "");
     std::map<MetadataType, std::string> metadata;
 
-    OrthancRestApi::GetIndex(call).GetAllMetadata(metadata, publicId);
+    assert(!call.GetFullUri().empty());
+    const std::string publicId = call.GetUriComponent("id", "");
+    const ResourceType level = StringToResourceType(call.GetFullUri() [0].c_str());
+
+    OrthancRestApi::GetIndex(call).GetAllMetadata(metadata, publicId, level);
 
     Json::Value result;
 
@@ -1495,14 +1497,15 @@
       return;
     }
 
-    CheckValidResourceType(call);
-    
-    std::string publicId = call.GetUriComponent("id", "");
+    assert(!call.GetFullUri().empty());
+    const std::string publicId = call.GetUriComponent("id", "");
+    const ResourceType level = StringToResourceType(call.GetFullUri() [0].c_str());
+
     std::string name = call.GetUriComponent("name", "");
     MetadataType metadata = StringToMetadata(name);
 
     std::string value;
-    if (OrthancRestApi::GetIndex(call).LookupMetadata(value, publicId, metadata))
+    if (OrthancRestApi::GetIndex(call).LookupMetadata(value, publicId, level, metadata))
     {
       call.GetOutput().AnswerBuffer(value, MimeType_PlainText);
     }