Post JSON on URL HTTP Web Request with VB.NET -
i using online nlp api called wit.ai. sending http web request, , response, , works fine. however, need know how post json:
{ "state": "email_or_text" }
as addition code:
function getjson() dim editedtext string = textbox1.text.replace(" ", "%20") dim myhttpwebrequest = ctype(webrequest.create("https://api.wit.ai/message?v=20140609&q=" + editedtext + "&units=metric"), httpwebrequest) myhttpwebrequest.headers.add("authorization: bearer <myauthcode>") dim myhttpwebresponse = ctype(myhttpwebrequest.getresponse(), httpwebresponse) dim mywebsource new streamreader(myhttpwebresponse.getresponsestream()) dim mypagesource string = mywebsource.readtoend() return mypagesource end function
thanks help!
check code @ http://dotnetpad.com/9o883hmi has quick example of post method can started on posting json. modify url , content string , hit run , see results!
Comments
Post a Comment