Advertisement
axellus

post

Feb 26th, 2020
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. public async static Task<string> PostRequestSendReadyDocument()
  2. {
  3. using (var httpClient = new HttpClient())
  4. {
  5. using (var request = new HttpRequestMessage(new HttpMethod("POST"), "https://api.getaccept.com/v1/documents/595d2hrwg4j/send"))
  6. {
  7. var key = PostRequestAuthKey().Result;
  8. request.Headers.TryAddWithoutValidation("Authorization", "Bearer "+ key);
  9. request.Content = new StringContent("\t\n{\n\t \"sender_id\": \"5qr8darqd3r\"\n\t}\n");
  10. request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
  11. var response = await httpClient.SendAsync(request);
  12. string responseBody = await response.Content.ReadAsStringAsync();
  13. string prettyJson = JToken.Parse(responseBody).ToString();
  14. Console.WriteLine(prettyJson);
  15. return prettyJson;
  16. }
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement