Announce Upload
This service is used to upload an audio file to the contact center. After uploading, the contact center returns the filename
in the response, which you can use in the audio file addition API.
Parameters
Description | Defined Data | Example Data | Required[**]/Optional[*] | Parameters |
---|---|---|---|---|
Audio File Path | - | c:users\users\Desktop\file.mp3 | ** | file |
Sample Invocation
- Example Code To Use
- Example Output
- PHP
- JS
- Curl
Show Full Source Code PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'http://192.168.51.20/api/v4/autodialer/announcements/upload',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('file'=> new CURLFILE('/C:/Users/Vsadrnia/Downloads/Record (online-voice-recorder.com).mp3')),
CURLOPT_HTTPHEADER => array(
'X-APIKEY: 9UV0BWKRL83PYIH9Gv1fI85d41lO4S932EeX3wHC47sHjMJOMG',
'Authorization: Basic c2FkcjpTYWRyQDEyMw=='
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
Show Full Source Code JS
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<script>
var form = new FormData();
form.append("file", fileInput.files[0], "/C:/Users/Vsadrnia/Downloads/Record (online-voice-recorder.com).mp3");
var settings = {
"url": "http://192.168.51.20/api/v4/autodialer/announcements/upload",
"method": "POST",
"timeout": 0,
"headers": {
"X-APIKEY": "9UV0BWKRL83PYIH9Gv1fI85d41lO4S932EeX3wHC47sHjMJOMG",
"Authorization": "Basic c2FkcjpTYWRyQDEyMw=="
},
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
</script>
</body>
</html>
Show Full Source Code Curl
curl --location --request POST 'http://192.168.51.20/api/v4/autodialer/announcements/upload' \
--header 'X-APIKEY: 9UV0BWKRL83PYIH9Gv1fI85d41lO4S932EeX3wHC47sHjMJOMG' \
--header 'Authorization: Basic c2FkcjpTYWRyQDEyMw==' \
--form 'file=@"/C:/Users/Vsadrnia/Downloads/Record (online-voice-recorder.com).mp3"'
{
"success": 1,
"message": "",
"data": {
"filename": "file-20200825065434-58826-bbc-farsi-pargarmp3_.wav"
}
}