-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchatbot.js
34 lines (31 loc) · 1007 Bytes
/
chatbot.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function synchronize() {
var jsonData = {
qnaList: [
{
id: 0,
answer: 'Hello',
source: 'Custom Editorial',
questions: [
'Hi','Hello'
],
metadata: [
{
name: 'category',
value: 'api'
}
]
}
]
}
var request = new XMLHttpRequest();
request.open("PATCH", "https://westus.api.cognitive.microsoft.com/qnamaker/v4.0/knowledgebases/{kbId}", true);
request.setRequestHeader("Ocp-Apim-Subscription-Key", "{key}");
request.setRequestHeader("Content-type", "application/json");
request.onreadystatechange = function () {
//Call a function when the state changes.
if (request.readyState == 4) {
alert(request.responseText);
}
}
request.send(JSON.stringify(jsonData));
}