From 2b4770301cbcaed3838ae3c0b175a985d1b4fb4f Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 7 Mar 2016 15:00:03 +0100 Subject: [PATCH] Add version in API --- app/config/security.yml | 1 + .../ApiBundle/Controller/WallabagRestController.php | 13 +++++++++++++ 2 files changed, 14 insertions(+) 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. -- 2.41.0