How to consume a Web API using RestSharp

Take advantage of the flexible and easy-to-use RestSharp HTTP API client to consume your REST APIs

Become An Insider

Sign up now and get FREE access to hundreds of Insider articles, guides, reviews, interviews, blogs, and other premium content. Learn more.

When working with APIs you might often need to interface with public APIs and perform CRUD operations. To connect to and work with such APIs, you have libraries aplenty. One of the most popular is RestSharp, mainly because of its simplicity.

RestSharp is an open source HTTP client library that can interface with public APIs and consume data without the need to deal with the complexity of the raw HTTP requests. It is an easy to use and powerful library that you can leverage to consume your RESTful API built using .NET. The best thing in RestSharp is that it can even work with even .NET 2.0 and it supports Xamarin and Windows Phone as well. This article presents a discussion on RestSharp and how it can be used to consume RESTful APIs build using ASP.NET Web API.

Install RestSharp

You can install RestSharp in your project from the NuGet Package Manager UI or by typing the following command in the NuGet Package Manager console.

Install-Package RestSharp

As of this writing, the latest stable version of RestSharp is 106.2.1.

To continue reading this article register now