This endpoint is used to create a new account. The request method of this call needs to be "POST".
https://api2.pushassist.com/accounts/
| Parameter Name | Description |
|---|---|
| name | Account holder full name |
| company_name | Your company name ( Optional ) |
| Account holder email address | |
| password | Account password |
| protocol | Your website prototype (https:// OR http://) |
| siteurl | Your website URL (without website prototype https:// OR http://) |
| subdomain | Your account name (It can only contain a-z, 0-9 characters.) |
function create_account($response_array){
$url = 'https://api2.pushassist.com/accounts/';
$headers = array(
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($response_array));
curl_setopt($ch, CURLOPT_SSLVERSION, 4);
$result = curl_exec($ch);
if ($result === FALSE) {
die('Curl failed: ' . curl_error($ch));
}
curl_close($ch);
$result_arr = json_decode($result, true);
return $result_arr;
}
$remoteContent = array("account" => array("name" => trim($name),
"company_name" => trim($company_name),
"contact" => trim($contact),
"email" => trim($email),
"password" => trim($password),
"protocol" => trim($protocol),
"siteurl" => trim($site_url),
"subdomain" => trim($sub_domain))
);
$response = create_account($remoteContent);
if($response['status'] == 'Success'){
echo $response['response_message'];
echo $response['api_key'];
echo $response['auth_secret'];
} else if($response['status'] == 'Error') {
echo $response['error_message'];
} else if($response['error'] != ''){
echo $response['error'];
} else {
echo $response['errors'];
}