]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ApiBundle/Controller/WallabagRestController.php
Merge pull request #2677 from wallabag/add-wallabag_user.de.yml
[github/wallabag/wallabag.git] / src / Wallabag / ApiBundle / Controller / WallabagRestController.php
index e927a8903a26af16f796fa8016e6dad7322d5b5a..b1e08ca441a00c578d6939cf5455728bc2035460 100644 (file)
@@ -3,11 +3,27 @@
 namespace Wallabag\ApiBundle\Controller;
 
 use FOS\RestBundle\Controller\FOSRestController;
+use Nelmio\ApiDocBundle\Annotation\ApiDoc;
+use Symfony\Component\HttpFoundation\JsonResponse;
 use Symfony\Component\Security\Core\Exception\AccessDeniedException;
-use Wallabag\CoreBundle\Entity\Entry;
 
 class WallabagRestController extends FOSRestController
 {
+    /**
+     * Retrieve version number.
+     *
+     * @ApiDoc()
+     *
+     * @return JsonResponse
+     */
+    public function getVersionAction()
+    {
+        $version = $this->container->getParameter('wallabag_core.version');
+        $json = $this->get('serializer')->serialize($version, 'json');
+
+        return (new JsonResponse())->setJson($json);
+    }
+
     protected function validateAuthentication()
     {
         if (false === $this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) {