summaryrefslogtreecommitdiffstats
path: root/admin/WebConsole/rest
diff options
context:
space:
mode:
authorramon <ramongomez@us.es>2017-12-14 11:06:36 +0000
committerramon <ramongomez@us.es>2017-12-14 11:06:36 +0000
commitfce0af30c330da39d8af2bf97c895b3fbec4d62b (patch)
tree672e22b5efe8fdf927a796df17efd3548a5d2b62 /admin/WebConsole/rest
parentb46042c67f764c242943be42e2fd20eb65fbd4a1 (diff)
#743: Usar formato JSON en entrada a ruta REST {{{POST /repository/poweron}}}.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@5533 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'admin/WebConsole/rest')
-rw-r--r--admin/WebConsole/rest/repository.php8
1 files changed, 3 insertions, 5 deletions
diff --git a/admin/WebConsole/rest/repository.php b/admin/WebConsole/rest/repository.php
index 6e2a3f03..7ac6e88e 100644
--- a/admin/WebConsole/rest/repository.php
+++ b/admin/WebConsole/rest/repository.php
@@ -183,19 +183,17 @@ $app->get('/repository/image(/:ouname)/:imagename(/)', 'validateRepositoryApiKey
* @return JSON string ok if the power on command was sent
*/
$app->post('/repository/poweron', 'validateRepositoryApiKey',
- function() {
- $app = \Slim\Slim::getInstance();
+ function() use($app) {
// Debe venir el parametro macs en el post (objeto JSON con array de MACs)
- $data = $app->request()->post();
+ $data = json_decode($app->request()->getBody());
if(empty($data->macs)){
// Print error message.
$response['message'] = 'Required param macs not found';
jsonResponse(400, $response);
}
else{
- $macs = $data->macs;
$strMacs = "";
- foreach($macs as $mac){
+ foreach($data->macs as $mac){
$strMacs .= " ".$mac;
}
// Ejecutar comando wakeonlan, debe estar disponible en el sistema operativo