Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Azure Function call

(0) ShareShare
ReportReport
Posted on by 1,611

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 

pastedimage1648023348864v1.pngpastedimage1648658065916v1.png

Em I missing something here ??

Thanks,

TK

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 997 Moderator on at
    RE: Azure Function call

    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;

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,307 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans