var client = new RestClient("https://api.mysite.com"); var request = new RestRequest("users/{id}", Method.GET); request.AddUrlSegment("id", "1234"); var response = client.Execute(request);
var client = new RestClient("https://api.mysite.com"); var request = new RestRequest("products/{product_id}/reviews/{review_id}", Method.POST); request.AddUrlSegment("product_id", "456"); request.AddUrlSegment("review_id", "789"); request.AddParameter("rating", 4); var response = client.Execute(request);In this example, we are creating a POST request to the URL https://api.mysite.com/products/456/reviews/789. The {product_id} and {review_id} segments are replaced with the values "456" and "789" respectively using the AddUrlSegment method. We are also adding a rating parameter to the request using the AddParameter method. The RestSharp library is available as a NuGet package that can be installed in Visual Studio.