Tuesday, August 2, 2016

Quick and easy way to consume a REST service


//Define URI
string uri = http://blah/blah/

//Define REST variable
string id = "someId";

//Create WebClient and consume REST service
string response = null;
using(WebClient client = new WebClient())
{
    response = client.UploadString(string.Format("{0}{1}", uri, id), "");
}

No comments: