Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voice Request method doesn't work #13

Open
vabed opened this issue Jun 24, 2017 · 3 comments
Open

Voice Request method doesn't work #13

vabed opened this issue Jun 24, 2017 · 3 comments

Comments

@vabed
Copy link

vabed commented Jun 24, 2017

Test for Voice Requst is failing

@sleeplessninja
Copy link

I just want to echo this. This seems true for this and the Xamarin api-ai.

The response I receive is:

Response:
StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.NoWriteNoSeekStreamContent, Headers:
{
Server: nginx/1.11.9
Date: Thu, 17 Aug 2017 13:22:06 GMT
Access-Control-Allow-Credentials: true
Via: 1.1 google
Alt-Svc: clear
Content-Type: application/json; charset=UTF-8
Content-Length: 306
}
{
"id": "e2337b81-a4e8-42b5-a757-1a8a29ea0592",
"timestamp": "2017-08-17T13:22:06.164Z",
"lang": "en",
"status": {
"code": 400,
"errorType": "bad_request",
"errorDetails": "Invalid request content type, expecting "multipart/form-data" or "application/json; charset\u003dutf-8."
}
}

The post request I send is:
Request:
Method: POST, RequestUri: 'https://api.api.ai/v1/query?v=20150910', Version: 1.1, Content: System.Net.Http.MultipartFormDataContent, Headers:
{
Accept: application/json
Authorization: Bearer 8aa3b65982184361b3cbcd26898a27ec
Content-Type: multipart/form-data; boundary="16dd3efb-bdae-457a-beb1-124d6f3f9c6f"
}
--16dd3efb-bdae-457a-beb1-124d6f3f9c6f
Content-Type: application/json; charset=utf-8
Content-Disposition: form-data; name=request

{"timezone":"Eastern Standard Time","lang":"en","sessionId":"5e69c192-1034-45ac-ba7f-5508e078313e"}
--16dd3efb-bdae-457a-beb1-124d6f3f9c6f
Content-Disposition: form-data; name=voiceData; filename=voice.wav
Content-Type: audio/wav

--16dd3efb-bdae-457a-beb1-124d6f3f9c6f--

@farsan
Copy link

farsan commented Sep 11, 2017

I have the same issue. VoiceRequest method of the example does not work. I use DotNet SDK.

@ndnparis
Copy link

ndnparis commented Dec 19, 2017

@sleeplessninja Hi,
It is quite weird! I still can send a CURL request and it works.

curl -H "Authorization: Bearer Client_Id" "https://api.dialogflow.com/v1/query?v=20150910e=WELCOME&timezone=Europe/Paris&lang=en&sessionId=1234567890"
{
"id": "6aa918d6-8330-4c29-8fce-70418c28444a",
"timestamp": "2017-12-19T12:57:33.871Z",
"lang": "en",
"result": {
"source": "agent",
"resolvedQuery": "WELCOME",
"action": "input.welcome",
"actionIncomplete": false,
"parameters": {
"user_name": ""
},
"contexts": [],
"metadata": {
"intentId": "d7ecd45a-4b6b-4549-91d1-d9d43f911ce1",
"webhookUsed": "false",
"webhookForSlotFillingUsed": "false",
"intentName": "Welcome"
},
"fulfillment": {
"speech": "",
"messages": [
{
"type": 0,
"speech": ""
}
]
},
"score": 1.0
},
"status": {
"code": 200,
"errorType": "success",
"webhookTimedOut": false
},
"sessionId": "1234567890"

However, I've the same issue when sending a request by http.post

welcomeURL = "https://api.dialogflow.com/v1/query?v=20150910";

header = {
"Authorization": "Bearer Client_Id",
"Content-Type": "application/json"
};

data = {
"event": "WELCOME",
"lang": "en",
"sessionId": "1321321",
"timezone": "Europe/Paris"
};

http.post(welcomeURL, data, header)
.then(data => {
  console.log(data + " - " + data.status);
  console.log(JSON.stringify(data));
}).catch(error => {
  console.log(error.status + " - " + error.message);
});

Invalid request content type, expecting \"multipart/form-data\" or \"application/json; charset\u003dutf-8.\

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants