PushAdmin API Access
Getting API Access Credentials:
- Login to PushAdmin -> API Credentials -> API Key & Auth Token.
Overview:
- Two authentication headers need to be sent along with every request:
X-Api-Key, X-Auth-Token
- Base API URL: https://apis.websitetoapk.com/pushadmin/api/v1/
- Following Actions can be made using APIs:
1) Send Broadcast BASE_API_URL/send_broadcast
2) Schedule Broadcast BASE_API_URL/schedule_broadcast
3) Send Individual & Multiple Device BASE_API_URL/send_individual
4) Schedule Individual & Multiple Device BASE_API_URL/schedule_broadcast
5) List of Apps in your PushAdmin Account BASE_API_URL/list_apps
- A WordPress Plugin for Auto Notifications Coming Soon.
Retrieve List of All Apps
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://apis.websitetoapk.com/pushadmin/api/v1/list_apps",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => array(
"content-type: application/x-www-form-urlencoded",
"X-Api-Key: api-key-here",
"X-Auth-Token: token-here"
),
));
$response = curl_exec($curl);
echo $response;
Common API Request Sample (PHP cURL):
Also, For Send Broadcast ( BASE_API_URL/send_broadcast ):
$curl = curl_init();
$payload = Array(
'packageName' => "com.test.yourpackage", //Required Parameter
'type' => "Simple", //Optional Parameter (Default: Simple, Possible Values: Simple, Image)
'title' => "Test Title", //Required Parameter
'description' => "Test Descriptioon", //Optional
'image' => "http://test.test/image.png", //Optional (Works only when type=Image)
'url' => "http://test.com", //Optional (Must be a URL if given)
'ring' => "RING", //Optional (Default: RING, Possible Values: RING, VIBE, RINGVIBE, SILENT)
// Further parameters described below for different APIs
//Above Options are common for all requests.
);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://apis.websitetoapk.com/pushadmin/api/v1/...", // As per your request
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => http_build_query($payload),
CURLOPT_HTTPHEADER => array(
"content-type: application/x-www-form-urlencoded",
"X-Api-Key: api-key-here",
"X-Auth-Token: token-here"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Schedule Broadcast ( BASE_API_URL/schedule_broadcast ):
//Payload in above request for send_broadcast and extras below:
$payload = Array(
...//Common
'timezone' => "Asia/Kolkata", //Your timezone (Required)
'datetime' => "2018-06-30 08:30:00", //Schedule Time (YYYY-MM-DD HH:MM:SS)(Required)
);
Send Individual & Multiple Devices ( BASE_API_URL/send_individual ):
To get device token, check 'getFirebaseDeviceToken()' JavaScript API
//Payload in above request for send_broadcast and extras below:
$payload = Array(
...//Common
'deviceToken' => "token1, token2, token3" //Required(Multiple Tokens comma seperated)
);
Schedule Individual & Multiple Devices ( BASE_API_URL/schedule_individual ):
//Payload in above request for send_broadcast and extras below:
$payload = Array(
...//Common
'deviceToken' => "token1, token2, token3" //Required(Multiple Tokens comma seperated)
'timezone' => "Asia/Kolkata", //Your timezone (Required)
'datetime' => "2018-06-30 08:30:00", //Schedule Time (YYYY-MM-DD HH:MM:SS)(Required)
);