diff Plugins/Samples/Common/OrthancHttpConnection.cpp @ 2183:1d0838b8e9c5

RestApiDelete and RestApiPut
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 25 Nov 2016 21:33:35 +0100
parents de32f3b4ff09
children a3a65de1840f
line wrap: on
line diff
--- a/Plugins/Samples/Common/OrthancHttpConnection.cpp	Fri Nov 25 19:08:10 2016 +0100
+++ b/Plugins/Samples/Common/OrthancHttpConnection.cpp	Fri Nov 25 21:33:35 2016 +0100
@@ -79,4 +79,29 @@
     client_.SetBody(body);
     client_.ApplyAndThrowException(result);
   }
+
+
+  void OrthancHttpConnection::RestApiPut(std::string& result,
+                                         const std::string& uri,
+                                         const std::string& body)
+  {
+    boost::mutex::scoped_lock lock(mutex_);
+
+    client_.SetMethod(Orthanc::HttpMethod_Put);
+    client_.SetUrl(url_ + uri);
+    client_.SetBody(body);
+    client_.ApplyAndThrowException(result);
+  }
+
+
+  void OrthancHttpConnection::RestApiDelete(const std::string& uri)
+  {
+    boost::mutex::scoped_lock lock(mutex_);
+
+    std::string result;
+
+    client_.SetMethod(Orthanc::HttpMethod_Delete);
+    client_.SetUrl(url_ + uri);
+    client_.ApplyAndThrowException(result);
+  }
 }