Initially download Restsharp
dll and Add it to the project reference. Call the same dll in your namespace
section to access its library.
In the below Example we will call simple function that
returns the GET method content as a string. For the below Example we need to
pass the get method URL as a parameter to the function as below.
public string ReadAssortmentData(string url)
{
var feedClient = new RestClient(url);
var requestClient = new RestRequest(Method.GET);
var jsonResponse = feedClient.Execute(requestClient);
return jsonResponse.Content.ToString();
}
Above function will convert the response (might be Json
also) to string and returns the output.