Add version in API

This commit is contained in:
Vincent 2016-03-07 15:00:03 +01:00
parent 1e5a4b36ab
commit 2b4770301c
2 changed files with 14 additions and 0 deletions

View 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 }

View 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.