diff options
author | Vincent <vincentbechu@gmail.com> | 2016-03-07 15:00:03 +0100 |
---|---|---|
committer | Vincent <vincentbechu@gmail.com> | 2016-03-07 15:00:03 +0100 |
commit | 2b4770301cbcaed3838ae3c0b175a985d1b4fb4f (patch) | |
tree | 240147dbec127bfb5c2d0ba3d5a196134ffea8b9 | |
parent | 1e5a4b36ab9e50047e48f247b84733bdf9417844 (diff) | |
download | wallabag-2b4770301cbcaed3838ae3c0b175a985d1b4fb4f.tar.gz wallabag-2b4770301cbcaed3838ae3c0b175a985d1b4fb4f.tar.zst wallabag-2b4770301cbcaed3838ae3c0b175a985d1b4fb4f.zip |
Add version in API
-rw-r--r-- | app/config/security.yml | 1 | ||||
-rw-r--r-- | src/Wallabag/ApiBundle/Controller/WallabagRestController.php | 13 |
2 files changed, 14 insertions, 0 deletions
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: | |||
53 | 53 | ||
54 | access_control: | 54 | access_control: |
55 | - { path: ^/api/doc, roles: IS_AUTHENTICATED_ANONYMOUSLY } | 55 | - { path: ^/api/doc, roles: IS_AUTHENTICATED_ANONYMOUSLY } |
56 | - { path: ^/api/version, roles: IS_AUTHENTICATED_ANONYMOUSLY } | ||
56 | - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY } | 57 | - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY } |
57 | - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } | 58 | - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } |
58 | - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } | 59 | - { 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 | |||
340 | 340 | ||
341 | return $this->renderJsonResponse($json); | 341 | return $this->renderJsonResponse($json); |
342 | } | 342 | } |
343 | /** | ||
344 | * Retrive version. | ||
345 | * | ||
346 | * @return Response | ||
347 | */ | ||
348 | public function getVersionAction() | ||
349 | { | ||
350 | $version = $this->container->getParameter('wallabag_core.version'); | ||
351 | |||
352 | $json = $this->get('serializer')->serialize($version, 'json'); | ||
353 | |||
354 | return $this->renderJsonResponse($json); | ||
355 | } | ||
343 | 356 | ||
344 | /** | 357 | /** |
345 | * Validate that the first id is equal to the second one. | 358 | * Validate that the first id is equal to the second one. |