$rs = UserService::checkAuthentication($app->request->headers->get('apiKey')); if ($rs["status"] != SUCCESS) { Utils::echoResponse($rs); return; } $userId = $rs['data']->id; //So even with a valid apiKey, the designer can access her own resources only $response = ExperienceService::getExperienceOfConsumer($userId); Utils::echoResponse($response); }); //Get content of an experience for SPVT $app->get('/experienceSnapshotForSpvt/:experienceId/:userId', function ($experienceId, $userId) use($app) { $rs = UserService::checkAuthentication($app->request->headers->get('apiKey')); if ($rs["status"] != SUCCESS) { Utils::echoResponse($rs); return; } $userId = $rs['data']->id; //So even with a valid apiKey, the designer can access her own resources only $response = ExperienceService::getExperienceSnapshotForSpvt($experienceId, $userId); Utils::echoResponse($response); }); $app->map('/hello', function () { echo "Welcome to SHARC 2.0 RESTful Web services"; })->via('GET', 'POST'); $app->map('/test/:designerId/:experienceId', function ($designerId, $experienceId) { //$results = Capsule::se DB::s:select('select * from SharcUsers where id = ?', array(5)); //echo $results->toJson(); echo MediaService::getMediaSizeForExperience($designerId, $experienceId); })->via('GET'); $app->run();