c# - Resource not found Face API 1.0 -
for love of life can not figure out why jason format ways wrong , using microsoft face api 1.0 create person within group
here code
protected async void btnaddfaces_click(object sender, eventargs e) { var client = new httpclient(); var querystring = httputility.parsequerystring(string.empty); string persongroupid = txtfriendlist.text.tolower(); string persons = txtfriendname.text.tolower(); // request headers client.defaultrequestheaders.add ("ocp-apim-subscription-key", "{yourkey}"); // request parameters var uri = "https://westus.api.cognitive.microsoft.com/face/v1.0/ persongroups/wowlist/persons?" + querystring; // httpresponsemessage response; // not sure think here problem string body = "{\"name\":\"" + "waheed" + "," + "\"}"; // request body using (var content = new stringcontent (body, encoding.utf8, "application/json")) { await client.putasync(uri, content) .continuewith(async responsetask => { var responsebody = await responsetask.result .content.readasstringasync(); txtfacelist.text = responsebody.tostring(); }); }// end of using statement }
what should happen http verb status ok 200 should return ,
{ "error": { "code": "resourcenotfound", "message": "the requested resource not found." } }
i @ previous post apply same approach , not work. can point me correct direction other jumping off roof.
thanks
you have wrong http verb. in case want use post, not put. therefore need change client call like:
await client.postasync(uri, content) .continuewith(async responsetask => { var responsebody = await responsetask.result.content.readasstringasync(); txtfacelist.text = responsebody.tostring(); });
Comments
Post a Comment