Hello Experts,
I am just consuming an azure function URL and in return giving them the purchase order number:-
In my debugger, I am receiving an HTTP status code 500 error , don't know why
Em I missing something here ??
Thanks,
TK
Http status message 500 is internal server error. That should indicate that the problem is within the azure function and not really in your Business Central code.
Here are some code i use for calling an azure function. I could see some differences around content and http headers
procedure SendToAzure(Payload: text): Boolean;
var
Setup: Record Azuresetup;
hclient: HttpClient;
respons: HttpResponseMessage;
Content: HttpContent;
ContentHeaders: HttpHeaders;
begin
if not AzureSetup.FindFirst() then error('%1 is empty', AzureSetup.TableCaption);
AzureSetup.TestField("Outgoing file url");
Content.WriteFrom(Payload);
Content.GetHeaders(ContentHeaders);
ContentHeaders.Clear();
ContentHeaders.Add('Content-Type', 'application/json');
hclient.Post(BankSetup."Outgoing file url", Content, respons);
if respons.IsSuccessStatusCode then begin
exit(true);
end else begin
Message(format(respons.HttpStatusCode));
exit(false);
end;
end;
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,228 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156