diff OrthancServer/OrthancRestApi.cpp @ 238:e4148b0ab1d0

statistics URI
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 30 Nov 2012 16:09:24 +0100
parents 16a4ac70bd8a
children 2442033911d6
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi.cpp	Fri Nov 30 15:45:15 2012 +0100
+++ b/OrthancServer/OrthancRestApi.cpp	Fri Nov 30 16:09:24 2012 +0100
@@ -296,15 +296,19 @@
   static void GetSystemInformation(RestApi::GetCall& call)
   {
     RETRIEVE_CONTEXT(call);
+    Json::Value result = Json::objectValue;
 
-    Json::Value result = Json::objectValue;
     result["Version"] = ORTHANC_VERSION;
     result["Name"] = GetGlobalStringParameter("Name", "");
-    result["TotalCompressedSize"] = boost::lexical_cast<std::string>
-      (context.GetIndex().GetTotalCompressedSize());
-    result["TotalUncompressedSize"] = boost::lexical_cast<std::string>
-      (context.GetIndex().GetTotalUncompressedSize());
+
+    call.GetOutput().AnswerJson(result);
+  }
 
+  static void GetStatistics(RestApi::GetCall& call)
+  {
+    RETRIEVE_CONTEXT(call);
+    Json::Value result = Json::objectValue;
+    context.GetIndex().ComputeStatistics(result);
     call.GetOutput().AnswerJson(result);
   }
 
@@ -631,6 +635,7 @@
 
     Register("/", ServeRoot);
     Register("/system", GetSystemInformation);
+    Register("/statistics", GetStatistics);
     Register("/changes", GetChanges);
     Register("/exports", GetExports);