|
|
@ -13,8 +13,10 @@ Every API Request must be contained the Api Key (using JSON parameter 'key') and
|
|
|
|
|
|
|
|
|
|
|
|
Testing API calls (using curl):
|
|
|
|
Testing API calls (using curl):
|
|
|
|
-------------------------------
|
|
|
|
-------------------------------
|
|
|
|
$ curl -d '{"key":"<key>","cmd":"getVersion"}' '<Address>/?p=api'
|
|
|
|
$ curl -d '{"cmd":"getVersion"}' '<Address>/?p=api'
|
|
|
|
|
|
|
|
$ curl -d '{"cmd":"getApiKey","user":"admin","pw":"admin"}' '<Address>/?p=api'
|
|
|
|
|
|
|
|
$ curl -d '{"key":"<key>","cmd":"getRoom"}' '<Address>/?p=api'
|
|
|
|
|
|
|
|
$ curl -d '{"key":"<key>","cmd":"sendmessage","uid":"23","text":"test message"}' '<Address>/?p=api'
|
|
|
|
|
|
|
|
|
|
|
|
Methods without key:
|
|
|
|
Methods without key:
|
|
|
|
--------------------
|
|
|
|
--------------------
|
|
|
@ -90,6 +92,14 @@ getMessage
|
|
|
|
[{"id":"1"},{"id":"2"},{"id":"3"}]
|
|
|
|
[{"id":"1"},{"id":"2"},{"id":"3"}]
|
|
|
|
{"id":"3","Datum":"1388247583","SUID":"23","RUID":"42","isRead":"N","Text":"message text"}
|
|
|
|
{"id":"3","Datum":"1388247583","SUID":"23","RUID":"42","isRead":"N","Text":"message text"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sendMessage
|
|
|
|
|
|
|
|
Description:
|
|
|
|
|
|
|
|
send a Message to an other angel
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
|
|
|
|
uid (integer) - User ID of the reciever
|
|
|
|
|
|
|
|
text (string) - Message Text
|
|
|
|
|
|
|
|
Return Example:
|
|
|
|
|
|
|
|
{"status":"success"}
|
|
|
|
|
|
|
|
|
|
|
|
************************************************************************************************/
|
|
|
|
************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
@ -98,7 +108,7 @@ getMessage
|
|
|
|
* General API Controller
|
|
|
|
* General API Controller
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function api_controller() {
|
|
|
|
function api_controller() {
|
|
|
|
global $DataJson, $_REQUEST;
|
|
|
|
global $user, $DataJson, $_REQUEST;
|
|
|
|
|
|
|
|
|
|
|
|
header("Content-Type: application/json; charset=utf-8");
|
|
|
|
header("Content-Type: application/json; charset=utf-8");
|
|
|
|
|
|
|
|
|
|
|
@ -160,6 +170,9 @@ function api_controller() {
|
|
|
|
case 'getmessage':
|
|
|
|
case 'getmessage':
|
|
|
|
getMessage();
|
|
|
|
getMessage();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'sendmessage':
|
|
|
|
|
|
|
|
sendMessage();
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
$DataJson = array (
|
|
|
|
$DataJson = array (
|
|
|
|
'status' => 'failed',
|
|
|
|
'status' => 'failed',
|
|
|
@ -295,4 +308,30 @@ function getMessage(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Send Message
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
function sendMessage(){
|
|
|
|
|
|
|
|
global $DataJson, $_REQUEST;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!isset($_REQUEST['uid']) ) {
|
|
|
|
|
|
|
|
$DataJson = array (
|
|
|
|
|
|
|
|
'status' => 'failed',
|
|
|
|
|
|
|
|
'error' => 'Missing parameter "uid".' );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
elseif (!isset($_REQUEST['text']) ) {
|
|
|
|
|
|
|
|
$DataJson = array (
|
|
|
|
|
|
|
|
'status' => 'failed',
|
|
|
|
|
|
|
|
'error' => 'Missing parameter "text".' );
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if( mMessage_Send( $_REQUEST['uid'], $_REQUEST['text']) === true) {
|
|
|
|
|
|
|
|
$DataJson = array( 'status' => 'success');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$DataJson = array(
|
|
|
|
|
|
|
|
'status' => 'failed',
|
|
|
|
|
|
|
|
'error' => 'Transmitting was terminated with an Error.');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
?>
|