Step 1
Add references to:
- Microsoft.Http.dll
- Microsoft.Http.Extention.dll
Step 2
using Microsoft.Http;
Step 3
Create HTTP client
HttpClient http = new HttpClient(baseUrl);
You can also add authentication (basic)
http.TransportSettings.Credentials = new NetworkCredential(userName, password);
Step 4 (Get)
Get resource
// Optional. Add query parameters
HttpQueryString query = new HttpQueryString();
query.Add("f", "xml");
// Add relative uri of a resource
Uri uri = new Uri("resource_name", UriKind.Relative);
// Get Resource
HttpResponseMessage resp = http.Get(uri,query);
Step 4 (Post/Put/Delete/)
HttpClient has support of Post/Put/Delete methods