Upload Announcement API
http://<domain_name>/api/voice/upload_announcement.php?username=<username>&token=<token>&announcement_path=<announcement_path>
Upload Announcement API through Sarv
request.post({url:'http://<domain_name>/api/voice/upload_announcement.php', formData: {'username':'username','token':'abcXYZ','announcement_path':'announcement_path'}}, function optionalCallback(err, httpResponse, body) {
if (err) {
return console.error('upload failed:', err);
}
console.log('Upload successful! Server responded with:', body);
console.log(body);
/*
{
"status":"success",
"code":"000",
"desc":"Announcement Uploaded Successfully",
"data":
{
"announcement_id":"1234",
"announcement_name":"filename.mp3"
}
}
*/
});
{
"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 . |