Skip to content

Instantly share code, notes, and snippets.

@biomood
Created June 2, 2011 13:56
Show Gist options
  • Save biomood/1004476 to your computer and use it in GitHub Desktop.
Save biomood/1004476 to your computer and use it in GitHub Desktop.
POST to restful service using .Net and RestSharp
// create the client
RestClient client = new RestClient();
client.BaseUrl = url;
// create the request
RestRequest request = new RestRequest(Method.POST);
request.Resource = service_method;
request.AddParameter("text/xml", body, ParameterType.RequestBody);
// send the request
RestResponse response = client.Execute(request);
// get content from response
string returnResponse = response.Content;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment