changeset 5611:1a995c6f9dae

deprecating the "requestedTags" GET argument in favor of "requested-tags"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 09 May 2024 10:43:10 +0200
parents c2a2fb8e868d
children f1ce8dd361b7 335e2079de1f 790335c99713
files NEWS OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp
diffstat 2 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Wed May 08 10:30:34 2024 +0200
+++ b/NEWS	Thu May 09 10:43:10 2024 +0200
@@ -10,6 +10,7 @@
   /patients|studies|series/instances/../reconstruct to speed up the reconstruction
   in case you just want to update the MainDicomTags of that resource level only 
   e.g. after you have updated the 'ExtraMainDicomTags' for this level.
+* The "requestedTags" GET argument was deprecated in favor of "requested-tags".
 
 Plugins
 -------
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp	Wed May 08 10:30:34 2024 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp	Thu May 09 10:43:10 2024 +0200
@@ -489,7 +489,8 @@
   static const std::string GET_SIMPLIFY = "simplify";
   static const std::string GET_FULL = "full";
   static const std::string GET_SHORT = "short";
-  static const std::string GET_REQUESTED_TAGS = "requestedTags";
+  static const std::string GET_REQUESTED_TAGS_OLD = "requestedTags";  // This was the only option in Orthanc <= 1.12.3
+  static const std::string GET_REQUESTED_TAGS = "requested-tags";
 
   static const std::string POST_SIMPLIFY = "Simplify";
   static const std::string POST_FULL = "Full";
@@ -603,18 +604,29 @@
   {
     requestedTags.clear();
 
+    std::string s;
+
     if (call.HasArgument(GET_REQUESTED_TAGS))
     {
+      s = call.GetArgument(GET_REQUESTED_TAGS, "");
+    }
+    else if (call.HasArgument(GET_REQUESTED_TAGS_OLD))
+    {
+      // This is for backward compatibility with Orthanc <= 1.12.3
+      s = call.GetArgument(GET_REQUESTED_TAGS_OLD, "");
+    }
+
+    if (!s.empty())
+    {
       try
       {
-        FromDcmtkBridge::ParseListOfTags(requestedTags, call.GetArgument("requestedTags", ""));
+        FromDcmtkBridge::ParseListOfTags(requestedTags, s);
       }
       catch (OrthancException& ex)
       {
         throw OrthancException(ErrorCode_BadRequest, std::string("Invalid requestedTags argument: ") + ex.What() + " " + ex.GetDetails());
       }
     }
-
   }
 
   void OrthancRestApi::DocumentRequestedTags(RestApiGetCall& call)