]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Add version in API
authorVincent <vincentbechu@gmail.com>
Mon, 7 Mar 2016 14:00:03 +0000 (15:00 +0100)
committerVincent <vincentbechu@gmail.com>
Mon, 7 Mar 2016 14:00:03 +0000 (15:00 +0100)
app/config/security.yml
src/Wallabag/ApiBundle/Controller/WallabagRestController.php

index 7f05123ab38cf51867dbb475f182ca8f65423316..0748c06ce03d316c67e5237541718569d95caa9a 100644 (file)
@@ -53,6 +53,7 @@ security:
 
     access_control:
         - { path: ^/api/doc, roles: IS_AUTHENTICATED_ANONYMOUSLY }
+        - { path: ^/api/version, roles: IS_AUTHENTICATED_ANONYMOUSLY }
         - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
         - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
         - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
index 35a90edde12bee3bc8b923edda9fa7311a4ff963..5f342825f08c3ca12c891df01ee0ae0f313e3e75 100644 (file)
@@ -340,6 +340,19 @@ class WallabagRestController extends FOSRestController
 
         return $this->renderJsonResponse($json);
     }
+    /**
+     * Retrive version.
+     *
+     * @return Response
+     */
+    public function getVersionAction()
+    {
+        $version = $this->container->getParameter('wallabag_core.version');
+
+        $json = $this->get('serializer')->serialize($version, 'json');
+
+        return $this->renderJsonResponse($json);
+    }
 
     /**
      * Validate that the first id is equal to the second one.