Reserve Available Telephony Number
https://manage.sarv.com/api/telephony/reserveTelephonyNumber
Reserved New Telephonic Number through Sarv
<?php
try {
$data = array('user_id' => '01234567', 'token' => 'abcXYZ','did_number'=>'9876543210');
$finalData['data'] = json_encode($data);
$url="https://manage.sarv.com/api/telephony/reserveTelephonyNumber";
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $finalData);
$responce=curl_exec($handle);
curl_close($handle);
$ARR_MSG = json_decode($responce, true);
if ($ARR_MSG['msg'] != "success") {
print_r($ARR_MSG);
return;
}
/*
Array
(
[msg] => "success"
[msg_text] => "Successfully Reserved for 7 Days"
)
*/
}
} catch (Sarv_Error $e) {
// Sarv errors are thrown as exceptions
echo "A sarv error occurred: " . get_class($e) . " - " . $e->getMessage();
}
?>
Array
(
[msg] => "success"
[msg_text] => "Successfully Reserved for 7 Days"
)
Array
(
[msg]=> "error"
[msg_text]=> "Human Readable Message"
)
Parameters |
user_id* string |
a valid Sarv User Id |
token* string |
a valid token |
did_number* string |
a valid Telephonic Number |
* compulsory field
** Either 'html' field Or 'text' field compulsory
Return Value: Success |
struct |
the results of Reserving Telephonic Number
msg string |
success |
msg_text string |
Successfully Reserved for 7 Days |
|
|
Return Value: Error |
struct |
the error results when attempt to Reserving Telephonic Number
msg string |
error |
msg_text string |
human readable message |
|
|