Blame view

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

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

5e2ea05e   Elena.Budnik   update REST
8
	require_once '../config.php';
16035364   Benjamin Renard   First commit
9

5e2ea05e   Elena.Budnik   update REST
10
11
12
13
14
15
16
	if (!key_exists("token", $_GET)) 
	{
		$result = array('success' => false, 'message' => "Authentication is required for this webservice.");
		exit(json_encode($result));
	} 
	
	$amda_ws = new WebServer();
70880168   Nathanael Jourdane   Add rate limit on...
17

5e2ea05e   Elena.Budnik   update REST
18
19
20
21
22
23
24
25
26
	if ($amda_ws->getNewToken()['token'] != $_GET["token"]) 
	{
		$result = array('success' => false, 'status' => 'expired', 'message' => "Token expired. Please authenticate again.");
	} else 
	{
		$result = $amda_ws->getParameter($_GET);
	}
	
	echo json_encode($result);
16035364   Benjamin Renard   First commit
27
?>