IRestClient client = new RestClient("https://api.example.com/"); IRestRequest request = new RestRequest("users/{id}", Method.GET); request.AddUrlSegment("id", "1234"); Uri uri = client.BuildUri(request);
IRestClient client = new RestClient("https://api.example.com/"); IRestRequest request = new RestRequest("search", Method.GET); request.AddParameter("q", "csharp"); request.AddParameter("limit", 10); Uri uri = client.BuildUri(request);In this example, we create a client that will connect to the "https://api.example.com/" API endpoint. We then create a request to search for information using the "q" query parameter with a value of "csharp" and a maximum of 10 results using the "limit" query parameter. We use the AddParameter method to add these parameters to the request. Finally, we use the BuildUri method to construct the full URI for the request, which would look like "https://api.example.com/search?q=csharp&limit=10". Package Library: RestSharp.