Equivalent of request curl en visual .net

1

As they are, I am trying to use the watson service, which makes a post request to an url, and the curl code is the following, I would like to know how I could do the equivalent of this request in visual .net with visual basic of language.

curl -X POST -u "{username}":"{password}" —-header "Content-Type:application/json" --data "{\"input\": {\"text\": \"Turn on the lights\"}, \"context\": {\"conversation_id\": \"1b7b67c0-90ed-45dc-8508-9488bc483d5b\", \"system\": {\"dialog_stack\": [\"root\"], \"dialog_turn_counter\": 1, \"dialog_request_counter\": 1}}}" "https://gateway.watsonplatform.net/conversation/api/v1/workspaces/25dfa8a0-0263-471b-8980-317e68c30488/message?version=2016-09-20"
    
asked by Kevin AB 05.01.2017 в 11:50
source

1 answer

2

curl is a command line tool that makes a REST request to a service, in your case Watson but in principle on any REST service.

To do it from Visual Basic or C # you have to use libraries that make this type of calls or make them yourself.

Although you will find many information on the subject, you can start with this article from CodeProject .

There are several REST libraries for .Net, among them perhaps the most used is RestSharp .

    
answered by 10.01.2017 в 10:42