diff --git a/lib/Alchemy/Phrasea/Application/ApiVersion.php b/lib/Alchemy/Phrasea/Application/ApiVersion.php index 97410b81d1..ba92e9255a 100644 --- a/lib/Alchemy/Phrasea/Application/ApiVersion.php +++ b/lib/Alchemy/Phrasea/Application/ApiVersion.php @@ -30,32 +30,35 @@ return call_user_func(function() { $app["appbox"] = \appbox::get_instance($app['Core']); $app->get( - '/', function() use ($app) { + '/', function(Request $request) use ($app) { $registry = $app["Core"]->getRegistry(); $apiAdapter = new \API_V1_adapter(false, $app["appbox"], $app["Core"]); - $versionNumber = (float) \Alchemy\Phrasea\Core\Version::getNumber(); - $ret = array( - 'install_name' => $registry->get('GV_homeTitle'), - 'description' => $registry->get('GV_metaDescription'), - 'documentation' => 'https://docs.phraseanet.com/Devel', - 'versions' => array( - '1' => array( - 'number' => $apiAdapter->get_version(), - 'uri' => '/api/v1/', - 'authenticationProtocol' => 'OAuth2', - 'authenticationVersion' => 'draft#v9', - 'authenticationEndPoints' => array( - 'authorization_token' => '/api/oauthv2/authorize', - 'access_token' => '/api/oauthv2/token' + + $result = new \API_V1_result($request, $apiAdapter); + + $result->set_datas( + array( + 'name' => $registry->get('GV_homeTitle'), + 'type' => 'phraseanet', + 'description' => $registry->get('GV_metaDescription'), + 'documentation' => 'https://docs.phraseanet.com/Devel', + 'versions' => array( + '1' => array( + 'number' => $apiAdapter->get_version(), + 'uri' => '/api/v1/', + 'authenticationProtocol' => 'OAuth2', + 'authenticationVersion' => 'draft#v9', + 'authenticationEndPoints' => array( + 'authorization_token' => '/api/oauthv2/authorize', + 'access_token' => '/api/oauthv2/token' + ) ) ) ) ); - $json = $app["Core"]['Serializer']->serialize($ret, 'json'); - - return new Response($json, 200, array('content-type' => 'application/json')); + return $result->get_response(); }); return $app; diff --git a/lib/classes/API/V1/adapter.class.php b/lib/classes/API/V1/adapter.class.php index b34d2a5250..f28173ec11 100644 --- a/lib/classes/API/V1/adapter.class.php +++ b/lib/classes/API/V1/adapter.class.php @@ -24,7 +24,7 @@ class API_V1_adapter extends API_V1_Abstract * * @var string */ - protected $version = '1.1'; + protected $version = '1.2'; /** * Appbox where the API works