Inheritance: System.Net.WebClient
Example #1
0
 public string CallApiForDelete(String apiEndPoint, string accessToken)
 {
     var webClient = new ExtendedWebClient();
     Trace.TraceInformation(string.Format("CallApiForDelete: {0}", apiEndPoint));
     webClient.Headers.Add("Authorization", string.Format("bearer {0}", accessToken));
     webClient.Headers.Add("Content-Type", "application/vnd.inbloom+json");
     webClient.Headers.Add("Accept", "application/vnd.inbloom+json");
     return webClient.UploadString(apiEndPoint, "DELETE");
 }
Example #2
0
 public string CallApiForPost(string apiEndPoint, string accessToken, string data)
 {
     var webClient = new ExtendedWebClient();
     Trace.TraceInformation(string.Format("CallApiForPost: {0}", apiEndPoint));
     webClient.Headers.Add("Authorization", string.Format("bearer {0}", accessToken));
     webClient.Headers.Add("Content-Type", "application/vnd.slc+json");
     webClient.Headers.Add("Accept", "application/vnd.slc+json");
     return webClient.UploadString(apiEndPoint, "POST", data);
 }
Example #3
0
		private static ExtendedWebClient GetExtendedWebClient(string accessToken, RequestType requestType)
		{
			var restClient = new ExtendedWebClient();

			string bearerToken = string.Format("bearer {0}", accessToken);

			restClient.Headers.Add("Authorization", bearerToken);

			if (requestType == RequestType.Xml)
			{
				restClient.Headers.Add("Content-Type", "application/vnd.slc+json");
				restClient.Headers.Add("Accept", "application/vnd.slc+xml");
			}
			else
			{
				restClient.Headers.Add("Content-Type", "application/vnd.slc+json");
				restClient.Headers.Add("Accept", "application/vnd.slc+json");
			}

			return restClient;
		}