Skip to content

Instantly share code, notes, and snippets.

@GregTrevellick
Created June 12, 2018 17:56
Show Gist options
  • Save GregTrevellick/95957f644bcc93c414a4d2b6069385b2 to your computer and use it in GitHub Desktop.
Save GregTrevellick/95957f644bcc93c414a4d2b6069385b2 to your computer and use it in GitHub Desktop.
//GET:
var client = new RestClient("192.168.0.1");
var request = new RestRequest("api/item/", Method.GET);
var queryResult = client.Execute<List<Items>>(request).Data;
//POST:
var client = new RestClient("http://192.168.0.1");
var request = new RestRequest("api/item/", Method.POST);
request.RequestFormat = DataFormat.Json;
request.AddBody(new Item
{
ItemName = someName,
Price = 19.99
});
client.Execute(request);
//https://stackoverflow.com/questions/10226089/restsharp-simple-complete-example?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
//http://pawel.sawicz.eu/restsharp/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment