Created
October 1, 2014 19:18
-
-
Save borismod/9e7adcb808ed61000f7f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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