简体   繁体   English

为Curl命令创建等效的RestSharp

[英]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, 我需要将其转换为restSharp代码,

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. 我不知道如何解决这个-d参数。

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 http://www.hackered.co.uk/articles/sending-json-strings-with-restsharp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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