Blame view

php/rest/getParameter.php 591 Bytes
16035364   Benjamin Renard   First commit
1
<?php
16035364   Benjamin Renard   First commit
2

70880168   Nathanael Jourdane   Add rate limit on...
3
4
5
6
7
8
9
/**
 * @file getParameter.php
 * @brief  REST interface for service getParameter
 *
 *
 * @version $Id:  $
 */
16035364   Benjamin Renard   First commit
10

70880168   Nathanael Jourdane   Add rate limit on...
11
require_once '../config.php';
16035364   Benjamin Renard   First commit
12

70880168   Nathanael Jourdane   Add rate limit on...
13
14
$amda_ws = new WebServer();

a394ee09   Nathanael Jourdane   bugFix token
15
if (!key_exists("token", $_GET)) {
9b69cb35   Nathanael Jourdane   Implement batch m...
16
    $result = array('success' => false, 'message' => "Authentication is required for this webservice.");
a394ee09   Nathanael Jourdane   bugFix token
17
} else if ($amda_ws->getNewToken()['token'] != $_GET["token"]) {
9b69cb35   Nathanael Jourdane   Implement batch m...
18
    $result = array('success' => false, 'status' => 'expired', 'message' => "Token expired. Please authenticate again.");
a394ee09   Nathanael Jourdane   bugFix token
19
20
} else {
    $result = $amda_ws->getParameter($_GET);
70880168   Nathanael Jourdane   Add rate limit on...
21
}
9b69cb35   Nathanael Jourdane   Implement batch m...
22
echo json_encode($result);
16035364   Benjamin Renard   First commit
23
?>