diff Plugins/Samples/Common/OrthancPluginCppWrapper.cpp @ 3478:f93a9c6c00c5

added RestApiPost overload to retrieve a string response
author Alain Mazy <alain@mazy.be>
date Thu, 01 Aug 2019 11:46:01 +0200
parents 0371b65d5f76
children 94f4a18a79cc
line wrap: on
line diff
--- a/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Mon Jul 15 16:48:36 2019 +0200
+++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Thu Aug 01 11:46:01 2019 +0200
@@ -1249,6 +1249,29 @@
   }
 
 
+  bool RestApiPost(std::string& result,
+                   const std::string& uri,
+                   const void* body,
+                   size_t bodySize,
+                   bool applyPlugins)
+  {
+    MemoryBuffer answer;
+
+    if (!answer.RestApiPost(uri, body, bodySize, applyPlugins))
+    {
+      return false;
+    }
+    else
+    {
+      if (!answer.IsEmpty())
+      {
+        result.assign(answer.GetData(), answer.GetSize());
+      }
+      return true;
+    }
+  }
+
+
   bool RestApiPost(Json::Value& result,
                    const std::string& uri,
                    const void* body,