diff OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp @ 4462:da460bef88f8

"/modalities/{...}/query": New string argument "LocalAet"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 20 Jan 2021 17:02:10 +0100
parents 6831de40acd9
children 522e13a60cfc
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp	Wed Jan 20 14:51:48 2021 +0100
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp	Wed Jan 20 17:02:10 2021 +0100
@@ -670,6 +670,8 @@
         .SetRequestField(KEY_NORMALIZE, RestApiCallDocumentation::Type_Boolean,
                          "Whether to normalize the query, i.e. whether to wipe out from the query, the DICOM tags "
                          "that are not applicable for the query-retrieve level of interest", false)
+        .SetRequestField(KEY_LOCAL_AET, RestApiCallDocumentation::Type_String,
+                         "Local AET that is used for this commands, defaults to `DicomAet` configuration option", false)
         .SetAnswerField("ID", RestApiCallDocumentation::Type_JsonObject,
                         "Identifier of the query, to be used with `/queries/{id}`")
         .SetAnswerField("Path", RestApiCallDocumentation::Type_JsonObject,
@@ -703,6 +705,12 @@
       throw OrthancException(ErrorCode_BadFileFormat,
                              "The field " + std::string(KEY_QUERY) + " must contain a JSON object");
     }
+    else if (request.isMember(KEY_LOCAL_AET) &&
+             request[KEY_LOCAL_AET].type() != Json::stringValue)
+    {
+      throw OrthancException(ErrorCode_BadFileFormat,
+                             "The field " + std::string(KEY_LOCAL_AET) + " must contain a string");
+    }
     else
     {
       std::unique_ptr<QueryRetrieveHandler>  handler(new QueryRetrieveHandler(context));
@@ -727,6 +735,11 @@
         handler->SetFindNormalized(request[KEY_NORMALIZE].asBool());
       }
 
+      if (request.isMember(KEY_LOCAL_AET))
+      {
+        handler->SetLocalAet(request[KEY_LOCAL_AET].asString());
+      }
+
       AnswerQueryHandler(call, handler);
     }
   }