Obtener Datos de Servicio REST con RestSharp

Este fragmento de código nos permite hacer una llamada a un Web Service REST mediante la librería RestSharp.

var client = new RestClient("REST_SERVICE_URL");
client.Authenticator = new HttpBasicAuthenticator("USER", "PASSWORD");
var request = new RestRequest(Method.GET);
request.RequestFormat = DataFormat.Json;
IRestResponse response = client.Execute(request);
var content = response.Content;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.