Skip to main content

Call GET method RESTful Service using RestSharp

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.



Comments

  1. IEEE Final Year projects Project Center in Chennai are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation. For experts, it's an alternate ball game through and through. Smaller than expected IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble. Final Year Project Domains for IT It gives you tips and rules that is progressively critical to consider while choosing any final year project point.

    JavaScript Training in Chennai

    JavaScript Training in Chennai

    The Angular Training covers a wide range of topics including Components, project projects for cseAngular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

    ReplyDelete

Post a Comment