Loading page...
In order to use this service, you would need to perform an API `POST` request.
https://vas.purplecfs.com.au/api/formatnumbers/{your_apikey}
{"hash":"xxxxx", "number":"0450xxxxxx", "country":"AU", "format":"E164"}
{"code":200,"response":"OK","error":"none","input":"0450xxxxxx","output":"+61450xxxxxx","format":"E164"}
const apikey = '******.*************************************'; /* (1) your api key */
const apisalt = '************'; /* (2) your service api salt */
const url = 'https://vas.purplecfs.com.au/api/formatnumbers/' + apikey;
// requires NodeJs (or use your own 3rd party crypto helper)
const crypto = require('crypto');
const hash = crypto.createHash('sha256');
hash.update(apikey + apisalt);
// post body data
const data = {
hash: hash.digest('hex'),
number: '0415 415 415', /* (3) the `Input Data` name you assigned to the selected property in Zapier */
country: 'AU', /* (4) Define your Country Code manually or dynamically similar to value above. */
format: 'E164' /* (5) Define your conversion */
};
// request options
const options = {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
}
// send POST request
fetch(url, options)
.then(res => res.json())
.then(res => console.log(res));
<?php
// set some key vars
$apikey = '******.*************************************'; /* (1) your api key */
$apisalt = '************'; /* (2) your service api salt */
$url = 'https://vas.purplecfs.com.au/api/formatnumbers/' . $apikey;
// set the body data
$data = array(
'hash' => hash('sha256', $apikey . $apisalt),
'number' => '0450 777 999', /* (3) the `Input Data` name you assigned to the selected property in Zapier */
'country' => 'AU', /* (4) Define your Country Code manually or dynamically similar to value above. */
'format' => 'E164' /* (5) Define your conversion */
);
// open connection
$ch = curl_init();
// set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// execute post
$result = curl_exec($ch);
print_r($result); // use json_decode($result, true) to convert to an array
const apikey = '******.*************************************'; /* (1) your api key */
const apisalt = '************'; /* (2) your service api salt */
const url = 'https://vas.purplecfs.com.au/api/formatnumbers/' + apikey;
const crypto = require('crypto');
const hash = crypto.createHash('sha256');
hash.update(apikey + apisalt);
const data = {
hash: hash.digest('hex'),
number: inputData.phone, /* (3) the `Input Data` name you assigned to the selected property in Zapier */
country: 'AU', /* (4) Define your Country Code manually or dynamically similar to value above. */
format: 'E164' /* (5) Define your conversion */
};
try {
const config = {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
}
const response = await fetch(url, config);
const body = await response.text();
const obj = JSON.parse(body);
return {rawHTML: body, rCode: response.status, rMeaning: response.statusText, number: obj.output};
} catch (err) {
return {rawHTML: 'NA', rCode: '500', rMeaning: 'Try Catch Error - ' + err.message, number: inputData.phone};
}