RestSharp Simple REST and HTTP API Client for .NET
2021-05-12 16:29
标签:syn span tcl col tor exp username ring ade RestSharp Simple REST and HTTP API Client for .NET 标签:syn span tcl col tor exp username ring ade 原文地址:http://www.cnblogs.com/longling2344/p/7570119.htmlvar client = new RestClient("http://example.com");
// client.Authenticator = new HttpBasicAuthenticator(username, password);
var request = new RestRequest("resource/{id}", Method.POST);
request.AddParameter("name", "value"); // adds to POST or URL querystring based on Method
request.AddUrlSegment("id", "123"); // replaces matching token in request.Resource
// easily add HTTP Headers
request.AddHeader("header", "value");
// add files to upload (works with compatible verbs)
request.AddFile(path);
// execute the request
IRestResponse response = client.Execute(request);
var content = response.Content; // raw content as string
// or automatically deserialize result
// return content type is sniffed but can be explicitly set via RestClient.AddHandler();
RestResponse
文章标题:RestSharp Simple REST and HTTP API Client for .NET
文章链接:http://soscw.com/index.php/essay/84766.html