Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created September 1, 2023 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/effb99548b2175979943334d9fcc0dd8 to your computer and use it in GitHub Desktop.
Save bjoerntx/effb99548b2175979943334d9fcc0dd8 to your computer and use it in GitHub Desktop.
[HttpPost]
public bool WebHook([FromBody] object request) {
dynamic ProcessingRequest = JObject.Parse(request.ToString());
HttpClient client = new HttpClient();
HttpResponseMessage responseMessage = client.GetAsync(ProcessingRequest.RetrieveDocumentUrl.Value).Result;
if (responseMessage.IsSuccessStatusCode) {
string data = responseMessage.Content.ReadAsStringAsync().Result;
System.IO.File.WriteAllBytes("App_Data/" + ProcessingRequest.Id.Value + ".pdf", Convert.FromBase64String(data));
return true;
}
else
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment