My curl request is (It is working fine) :
curl -k -H "Authorization: Bearer " -H "ocp-apim-subscription-key: " -H "Accept-language: en-US" "https://api.api.ai/v1/tts?v=20150512&text=create+task+for+me" -o output.wav
My Angular Js code for above curl request (It is not working)
$http({
method: 'GET',
url: API_URL,
responseType: 'arraybuffer',
Headers: {
'Authorization': 'Bearer <my_access_token>',
'ocp-apim-subscription-key': '<my_key>',
'Accept-Language': 'en-US'},
}).success(function (data,status,headers,config) {
alert("Audio Result : " + data.byteLength);
// the success method called
}).error(function(data){
alert("Audio Error : "+JSON.stringify(data));
})
I need to get the output.wav file in the response but i only get the "Audio Result : 75 [or very according to data sent] " as an alert how i read the file from given server stream