]> git.proxmox.com Git - pve2-api-doc.git/blobdiff - data/PVEAPI.js
add usage information
[pve2-api-doc.git] / data / PVEAPI.js
index 58d15acea4f97099772e4b02e3cd81978a2d1925..ff3cd447fde239547a2a3eb8368e0df8db937783 100644 (file)
@@ -1,9 +1,3 @@
-Ext.require([
-    'Ext.tree.*',
-    'Ext.data.*',
-    'Ext.window.MessageBox'
-]);
-
 // avoid errors when running without development tools
 if (!Ext.isDefined(Ext.global.console)) {   
     var console = { 
@@ -89,15 +83,32 @@ Ext.onReady(function() {
 
        var items = [];
 
+       var clicmdhash = {
+           GET: 'get',
+           POST: 'create',
+           PUT: 'set',
+           DELETE: 'delete'
+       };
+
        Ext.Array.each(['GET', 'POST', 'PUT', 'DELETE'], function(method) {
            var info = md[method];
            if (info) {
 
+               var usage = "";
+
+               usage += "<table><tr><td>HTTP:&nbsp;&nbsp;&nbsp;</td><td>" + method + " /api2/json" + data.path + "</td></tr><tr><td>&nbsp</td></tr>";
+               usage += "<tr><td>CLI:</td><td>pvesh " + clicmdhash[method] + " " + data.path + "</td></tr></table>";
+
                var sections = [
                    {
                        title: 'Description',
                        html: Ext.htmlEncode(info.description),
                        bodyPadding: 10
+                   },
+                   {
+                       title: 'Usage',
+                       html: usage,
+                       bodyPadding: 10
                    }
                ];