I am using angular js to make POST request to API. I need to send some headers and audio file with it. I have written sample code for the same in controller.
$scope.files='bostonSeltics.wav';
$scope.getText = function (access_token) {$http({method:'POST',
url:'https://api.att.com/rest/1/SpeechToText',
headers:{
'Accept':'application/json',
'Authorization':'Bearer '+access_token,
'X-SpeechContext': 'Generic',
'Content-Type':'audio/wav'},
data:$scope.files}).success(function(response){
......
}).error(function(error){
......
});
I just wanted to know whether this correct method to send audio data or not.
Thanks in advance.
Regards, Mohan