Open vabed opened 7 years ago
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--
I have the same issue. VoiceRequest method of the example does not work. I use DotNet SDK.
@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.\
Test for Voice Requst is failing