Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. string contentJson = JsonConvert.SerializeObject(content);
  2. HttpRequestMessage httpRequest = new HttpRequestMessage(HttpMethod.Patch, baseUrl);
  3. HttpClient client = _clientFactory.CreateClient();
  4. httpRequest.Content = new StringContent(contentJson, Encoding.UTF8, "application/json-patch+json");
  5. httpRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json-patch+json"));
  6. httpRequest.Headers.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes($"{yourusername}:{yourpwd}")));
  7. HttpResponseMessage response = await client.SendAsync(httpRequest);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement