简体   繁体   中英

create RestSharp equivalent for Curl command

Here is the curl.

curl -H "Content-Type: application/json" -vX POST -d "[\"Channel1.Device1.tag1\"]" host_name/read

I need to convert it into restSharp code,

At the moment, I am doing,

var client = new RestClient("host_name/read");

var request = new RestRequest( Method.POST);

IRestResponse response = client.Execute(request);
var content = response.Content; // raw content as string

I don't know how to fix this -d param.

I was finally able to solve the question. Please see the below link for the answer it works like a charm.

http://www.hackered.co.uk/articles/sending-json-strings-with-restsharp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM