From: Vincent Date: Mon, 7 Mar 2016 14:00:03 +0000 (+0100) Subject: Add version in API X-Git-Tag: 2.0.0-beta.2~9^2~2 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=2b4770301cbcaed3838ae3c0b175a985d1b4fb4f;p=github%2Fwallabag%2Fwallabag.git Add version in API --- diff --git a/app/config/security.yml b/app/config/security.yml index 7f05123a..0748c06c 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -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 } diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 35a90edd..5f342825 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -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.