public AddParameter ( |
||
p | ||
return |
var client = new RestClient("https://api.example.com/"); var request = new RestRequest("users", Method.POST); request.AddParameter("name", "John Doe");
var client = new RestClient("https://api.example.com/"); var request = new RestRequest("users", Method.POST); var user = new { name = "John", age = 30 }; request.AddParameter("user", user, ParameterType.RequestBody);Here, we create an anonymous object "user" with two properties, "name" and "age". We add this object as a RequestBody parameter to the request. Package library: RestSharp.