diff OrthancServer/OrthancRestApi.cpp @ 418:b79bf2f4ab2e

execution of lua through REST
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 May 2013 12:03:25 +0200
parents 47d63c941902
children ccf3a0a43dac
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi.cpp	Tue May 07 10:31:32 2013 +0200
+++ b/OrthancServer/OrthancRestApi.cpp	Tue May 07 12:03:25 2013 +0200
@@ -362,6 +362,16 @@
     }
   }
 
+  static void ExecuteScript(RestApi::PostCall& call)
+  {
+    std::string result;
+    RETRIEVE_CONTEXT(call);
+    context.GetLuaContext().Execute(result, call.GetPostBody());
+    call.GetOutput().AnswerBuffer(result, "text/plain");
+  }
+
+
+
 
   // List all the patients, studies, series or instances ----------------------
  
@@ -1556,5 +1566,6 @@
     Register("/patients/{id}/anonymize", AnonymizePatientInplace);
 
     Register("/tools/generate-uid", GenerateUid);
+    Register("/tools/execute-script", ExecuteScript);
   }
 }