Browse Source

[API] Add version endpoint

Resolves: https://github.com/mailcow/mailcow-dockerized/issues/4553
Niklas Meyer 3 years ago
parent
commit
456b528785
2 changed files with 26 additions and 0 deletions
  1. 21 0
      data/web/api/openapi.yaml
  2. 5 0
      data/web/json_api.php

+ 21 - 0
data/web/api/openapi.yaml

@@ -5072,6 +5072,27 @@ paths:
         of used storage.
         of used storage.
       operationId: Get vmail status
       operationId: Get vmail status
       summary: Get vmail status
       summary: Get vmail status
+  /api/v1/get/status/version:
+    get:
+      responses:
+        "401":
+          $ref: "#/components/responses/Unauthorized"
+        "200":
+          content:
+            application/json:
+              examples:
+                response:
+                  value:
+                    version: "2022-04"
+          description: OK
+          headers: {}
+      tags:
+        - Status
+      description: >-
+        Using this endpoint you can get the current running release of this
+        instance.
+      operationId: Get version status
+      summary: Get version status
   /api/v1/get/syncjobs/all/no_log:
   /api/v1/get/syncjobs/all/no_log:
     get:
     get:
       responses:
       responses:

+ 5 - 0
data/web/json_api.php

@@ -1472,6 +1472,11 @@ if (isset($_GET['query'])) {
                   'solr_documents' => $solr_documents
                   'solr_documents' => $solr_documents
                 ));
                 ));
               break;
               break;
+              case "version":
+                echo json_encode(array(
+                  'version' => $GLOBALS['MAILCOW_GIT_VERSION']
+                ));
+              break;
               }
               }
             }
             }
           break;
           break;