Skip to content

Instantly share code, notes, and snippets.

@borismod
Created October 1, 2014 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save borismod/9e7adcb808ed61000f7f to your computer and use it in GitHub Desktop.
Save borismod/9e7adcb808ed61000f7f to your computer and use it in GitHub Desktop.
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