From 9376d70f0ccba49ead95ef47f0ecba568ea2d6e1 Mon Sep 17 00:00:00 2001 From: Marius Burkard Date: Mon, 23 May 2016 10:35:50 +0200 Subject: [PATCH] - added example for REST api --- remoting_client/examples/rest_example.php | 57 +++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 remoting_client/examples/rest_example.php diff --git a/remoting_client/examples/rest_example.php b/remoting_client/examples/rest_example.php new file mode 100644 index 0000000000..24a009c14b --- /dev/null +++ b/remoting_client/examples/rest_example.php @@ -0,0 +1,57 @@ + $remote_user, 'password' => $remote_pass, 'client_login' => false)); +if($result) { + $data = json_decode($result, true); + if(!$data) die("ERROR!\n"); + + $session_id = $data['response']; + + $result = restCall('client_get', array('session_id' => $session_id, 'client_id' => array('username' => 'abcde'))); + if($result) var_dump(json_decode($result, true)); + else print "Could not get client_get result\n"; + + // or by id + $result = restCall('client_get', array('session_id' => $session_id, 'client_id' => 2)); + if($result) var_dump(json_decode($result, true)); + else print "Could not get client_get result\n"; + + // or all + $result = restCall('client_get', array('session_id' => $session_id, 'client_id' => array())); + if($result) var_dump(json_decode($result, true)); + else print "Could not get client_get result\n"; + + $result = restCall('logout', array('session_id' => $session_id)); + if($result) var_dump(json_decode($result, true)); + else print "Could not get logout result\n"; +} -- GitLab