Example #1
0
    Utils::echoResponse($response);
});
//compress media
$app->post('/mediaCompress', function () use($app) {
    //Check authentication
    $rs = UserService::checkAuthentication($app->request->headers->get('apiKey'));
    if ($rs["status"] != SUCCESS) {
        Utils::echoResponse($rs);
        return;
    }
    //Get a user sent from client and convert it to a json object
    $jsonMedia = $app->request->getBody();
    $objMedia = json_decode($jsonMedia, true);
    $objMedia['fileName'] = $rs['data']->id;
    //So even with a valid apiKey, the designer can access her own resources only
    $response = MediaService::compressImage($objMedia);
    Utils::echoResponse($response);
});
//APIs For SMEP
//Get list of published experiences
$app->get('/experiences', function () {
    //should be published experiences only
    $response = ExperienceService::getPublishedExperiences();
    Utils::echoResponse($response);
});
//Get content of an experience for SMEP
$app->get('/experienceSnapshot/:experienceId', function ($experienceId) use($app) {
    $response = ExperienceService::getExperienceSnapshotForConsumer($experienceId);
    Utils::echoResponse($response);
});
//Tracking who logs into SMEP and consume which experience