Created
June 2, 2011 13:56
-
-
Save biomood/1004476 to your computer and use it in GitHub Desktop.
POST to restful service using .Net and RestSharp
This file contains hidden or 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
// 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