将cURL(--data-binary)Post命令转换为RestSharp代码

问题描述:

如何将此cURL转换为RestSharp将cURL(--data-binary)Post命令转换为RestSharp代码

卷曲-i -XPOST“http://localhost:8086/write?db=mydb” --data二进制“cpu_load_short,主机= SERVER01,地区=美国中西部值= 0.64”

这是一个怎样写记录到InfluxDB实例使用卷曲但我需要RestSharp等价物。

谢谢!

想通了这么回答我的问题:

var client = new RestClient("http://localhost:8086"); 
client.Authenticator = new HttpBasicAuthenticator("username", "password"); 
var request = new RestRequest ("write?db=mydb", Method.POST); 
request.AddParameter("text/plain", "cpu_load_short,host=server01,region=us-west value=0.64", ParameterType.RequestBody); 
IRestResponse response = client.Execute (request); 
var content = response.Content; 
Console.WriteLine (content);