Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System;
using RestSharp;
using RestSharp.Contrib;
using RestSharp.Deserializers;
namespace ReshSharpTrials
{
internal static class Program
{
private static void Main(string[] args)
{
// Create REST client
var client = new RestClient("http://resharpertnt.apphb.com/");
// Create REST GET request
var request = new RestRequest("api/tipsandtricks/", Method.GET);
// Execute the request on the client
var response = client.Execute(request);
// Create JSON deserializer
var deserializer = new JsonDeserializer();
// Deserialize to an instance of ResharperTip
ResharperTip resharperTip = deserializer.Deserialize<ResharperTip>(response);
// It is recommended to decode the tip which may contain HTML encoded strings
string tip = HttpUtility.HtmlDecode(resharperTip.Tip);
}
}
public class ResharperTip
{
public bool Success { get; set; }
public string Tip { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment