Push Server
Method : POST Base Path :to be defined Request Path : registerDevice Headers : Auth Headers (see 1.Authentification) Body: { "data" : { "gcmId" : String, //"3q907654v9ß28736..." contains the received GcmId "deviceCountryCode" : String, //2 digit lowercased countrycode e.g. "de" "utcOffset" : integer, // difference of the local time set on device vs. //UTC time rounded to full hours(integer) "appId" : String , // Identification of the sender App (MOD / AOD ...) "os" : String //operating system (Android / IOS) } }
Body: { "data" : { "result" : "success / internalError" } }
{ "priority" : "high", "data" : { "title" : String, "body" : String, "dealId" : integer } }
{ "content_available" : "true", "priority" : "high", "notification" : { "title" : String, "body" : String, "dealId" integer } }
Method : POST Base Path :to be defined Request Path : addTask Headers : Auth Headers (see 1.Authentification) Body: { "data" : { "dealid" //identifies the Deal "appid" : String, // Identification of the sender App (MOD / AOD ...) "countrycode" : String, //2 digit countrycode e.g. "de" "pushtime" : "1452008784", // the desired time for the push notification in utc "taskid" : integer, // unique id for identifying and if wished updating the task "os" : String, //operating system (Android / IOS) "environment" : String, //dev or prod "notification_title" : String, //push notification title "notification_body" : String //push notification body } }
Body: { "data": { "result": { "queueId": int //cakeId for Queues Entitys } } }
/** * Custom Configurations for Album of the day Plugin */ /** * Configurations for the Pushserver */ // PushServer Base Url Configure::write('AOD.pushserver.basePath','http://pushserver.sme-dev.com/'); //Path to PushServer method addTask Configure::write('AOD.pushserver.addTask','/queues/addTask'); Configure::write('AOD.pushserver.appid','mod '); Configure::write('AOD.pushserver.notification_title','Film des Tages '); Configure::write('AOD.pushserver.environment','prod'); // set Secret for communication with pushserver Configure::write('AOD.pushserver.backendSecret','1234567898765432123456798765432123465798876543212345678987654321 ');
//get Header Information for PushServer Security $security = $this->_getSecurityHeaders(); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json", "X-PushServer-backendTime: ".$security['time'], "X-PushServer-backendName: " . $security['appId'], "X-PushServer-backendSecret: ".$security['backendSecret'], "X-PushServer-backendToken: ".$security['backendToken'] ));
$request = array( 'data' => array( 'dealid' => $x, //int specifies the dealid which appears in AOD and MOD 'appid' => Configure::read('AOD.pushserver.appid'), 'countrycode' => $country, // de/en... 'pushtime' => $pushDate, //Datetime Onject specifiying the date and time the push is supposed to happen 'os' => $this->SmePushServerPlatform, 'environment' => Configure::read('AOD.pushserver.environment'), 'notification_title' => Configure::read('AOD.pushserver.notification_title'), 'notification_body' => $pushText ) );