I'm having trouble figuring out how to make a GET request using RestSharp on Windows Phone 7. All of the examples show making a POST request, but I just need GET. How do I do this?
GET is the default method used by RestSharp, so if you don't specify a method, it will use GET:
var client = new RestClient("http://example.com");
var request = new RestRequest("api");
client.ExecuteAsync(request, response => {
// do something with the response
});
This code will make a GET request to http://example.com/api
. If you need to add URL parameters you can do this:
var client = new RestClient("http://example.com");
var request = new RestRequest("api");
request.AddParameter("foo", "bar");
Which translates to http://example.com/api?foo=bar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With