Nachricht versenden
POST https://pushservice.it-weissmann.de/api/messages
BODY:
{
"topicToken": "<TOKEN>",
"title": "<TITLE>",
"description": "<DESCRIPTION>",
"date": "<DATE>"
}
Der Parameter Date ist dabei optional und kann als Timestamp angegeben werden.
Javascript
var xhr = new XMLHttpRequest();
xhr.open("POST", 'https://pushservice.it-weissmann.de/api/messages', true);
xhr.setRequestHeader("Content-Type", "application/json");
var message = {
"topicToken": "<TOKEN>",
"title": "<TITLE>",
"description": "<DESCRIPTION>",
"date": "<DATE>"
};
xhr.send(JSON.stringify(message));
PHP
$url = 'https://pushservice.it-weissmann.de/api/messages';
$ch = curl_init($url);
$jsonData = array(
'topicToken' => '<TOKEN>',
'title' => '<TITLE>',
'description' => '<DESCRIPTION>',
'date' => '<DATE>'
);
$jsonDataEncoded = json_encode($jsonData);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$result = curl_exec($ch);