azure cognitive services - QnAMaker Train API is not working -


i trying train microsoft qnamaker programmatically alternate question. calling rest api training more 50 times alternate question.

i calling below api "https://westus.api.cognitive.microsoft.com/qnamaker/v2.0/knowledgebases/e31c0d13-6531-4af6-9352-5f7c125d448d/train" more 50 times. providing alternate question, original question , answer while calling api. not working.the code provided below :

var client = new httpclient();             client.defaultrequestheaders.accept.clear();             client.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue("application/json"));             client.defaultrequestheaders.add("ocp-apim-subscription-key", "b6da7e5e904148a88e651d3781e3e519");             var uri = "https://westus.api.cognitive.microsoft.com/qnamaker/v2.0/knowledgebases/e31c0d13-6531-4af6-9352-5f7c125d448d/train";             httpresponsemessage response;             qnamakertrainobject data = new qnamakertrainobject();             data.feedbackrecords = new list<feedbackrecord>();             feedbackrecord f = new feedbackrecord();             f.kbquestion = "q3";             f.kbanswer = "a3";             f.userquestion = question;             f.userid = userid;             data.feedbackrecords.add(f);             string json = jsonconvert.serializeobject(data);             byte[] messagebytes = system.text.encoding.utf8.getbytes(json);              var content = new bytearraycontent(messagebytes);             content.headers.contenttype = new system.net.http.headers.mediatypeheadervalue("application/json");             var method = new httpmethod("patch");             var request = new httprequestmessage(method, uri);             request.content = content;             response = await client.sendasync(request);              if (response.issuccessstatuscode)             {                 var responsecontent = response.content;                 string responsestring = responsecontent.readasstringasync().result;             } 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -