示例#1
0
文件: index.php 项目: TrienDo/SHARC20
    }
    $jsonExperience = $app->request->getBody();
    $objExperience = json_decode($jsonExperience, true);
    $response = ExperienceService::updateExperience($id, $objExperience, $rs['data']->id);
    Utils::echoResponse($response);
});
//Get all experience of a designer with id
$app->get('/experiences/:id', function ($id) use($app) {
    $rs = UserService::checkAuthentication($app->request->headers->get('apiKey'));
    if ($rs["status"] != SUCCESS) {
        Utils::echoResponse($rs);
        return;
    }
    $id = $rs['data']->id;
    //So even with a valid apiKey, the designer can access her own resources only
    $response = ExperienceService::getExperienceOfDesigner($id);
    Utils::echoResponse($response);
});
$app->delete('/experiences/:designerId/:experienceId', function ($designerId, $experienceId) use($app) {
    $rs = UserService::checkAuthentication($app->request->headers->get('apiKey'));
    if ($rs["status"] != SUCCESS) {
        Utils::echoResponse($rs);
        return;
    }
    $designerId = $rs['data']->id;
    //So even with a valid apiKey, the designer can access her own resources only
    $response = ExperienceService::deleteExperience($designerId, $experienceId);
    Utils::echoResponse($response);
});
//Get content of an experience - use when loading an experience from SLAT
$app->get('/experiences/:designerId/:experienceId', function ($designerId, $experienceId) use($app) {