Upload Announcement API
http://<domain_name>/api/voice/upload_announcement.php?username=<username>&token=<token>&announcement_path=<announcement_path>
Upload Announcement API through Sarv
<?php
try {
$post_url = "http://your_domain/api/voice/upload_announcement.php";
$ARR_POST_DATA = array();
$ARR_POST_DATA['username'] = 'your_username';
$ARR_POST_DATA['token'] = "your_token";
$ARR_POST_DATA['announcement_path'] = "http://your_announcement_domain/your_announcment.mp3";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $post_url);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($ARR_POST_DATA));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($curl);
echo $response;
$arr_response = json_docode($response, true);
var_dump($arr_response);
curl_close($curl);
} catch (Sarv_Error $e) {
// Sarv errors are thrown as exceptions
echo "A sarv error occurred: " . get_class($e) . " - " . $e->getMessage();
}
?>
{
"status":"success",
"code":"000",
"desc":"Announcement Uploaded Successfully",
"data":
{
"announcement_id":"1234",
"announcement_name":"filename.mp3"
}
}
{
"status":"error",
"code":"007",
"desc":"Invalid announcement type (mp3 allowed only)"
}
Parameters |
username* string |
a valid Sarv SMS Panel User Name |
token* string |
a valid token |
announcement_path* string |
a valid Announcement Path |
* compulsory field
Return Value: Success |
struct |
the results of Upload Announcement API
status string |
success |
code string |
000 |
desc array |
{
"announcement_id":"1234",
"announcement_name":"filename.mp3"
} |
|
|
Return Value: Error |
struct |
the error results when Upload Announcement API
status string |
error |
code string |
007 |
desc string |
Invalid announcement type (mp3 allowed only) |
|
|
Api Response Codes |
000 |
Announcement Uploaded Successfully. |
001 |
Parameter Missing . |
002 |
Parameter is blank. |
003 |
Request IP not added in whitelist . |
004 |
Invalid user type. |
005 |
Invalid Credentials. |
006 |
User is InActive. |
007 |
Invalid announcement type . |