web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

POST API Call

(5) ShareShare
ReportReport
Posted on by 129
Hi, new to making API calls in AL code.  We have a piece of software that handles all our Support Desk tickets.  When a new Customer is created in BC, I want to be able making a POST API request to this software to create the Customer there too.  
 
Any ideas how to generate the API call with a header and a payload?   
 
I have used ChatGPT, but it keeps giving me incorrect code and has now advised me that BC cannot make POST calls and I would have to create and Azure function to handle this.
I have the same question (0)
  • Suggested answer
    DAnny3211 Profile Picture
    11,417 Super User 2026 Season 1 on at

    Hi DS-300515832,

    Thanks for your question! You can make POST API calls directly from AL code in Business Central, although it requires careful setup of the HTTP headers and payload.

    Here's a basic example to get you started:

     
    procedure SendCustomerToSupportDesk(Customer: Record Customer)
    var
        Client: HttpClient;
        Request: HttpRequestMessage;
        Response: HttpResponseMessage;
        Content: HttpContent;
        JsonPayload: Text;
    begin
        JsonPayload := '{ "name": "' + Customer.Name + '", "email": "' + Customer."E-Mail" + '" }';
     
        Content.WriteFrom(JsonPayload);
        Content.GetHeaders().Add('Content-Type', 'application/json');
     
        Request.SetRequestUri('https://your-supportdesk-api.com/customers');
        Request.Method := 'POST';
        Request.Content := Content;
        Request.GetHeaders().Add('Authorization', 'Bearer your_token_here');
     
        if Client.Send(Request, Response) then
            Message('Customer sent successfully!')
        else
            Error('Failed to send customer. Status: %1', Response.HttpStatusCode());
    end;

    Key Points:

    • Replace the URL and token with your actual API endpoint and credentials.
    • Ensure the Customer record contains the required fields.
    • You do not need an Azure Function unless the external API has specific constraints or security requirements.

    Let me know if this helps, and please mark the response as helpful if it answered your question 😊

    Best regards!

  • Suggested answer
    YUN ZHU Profile Picture
    99,086 Super User 2026 Season 1 on at
    Hi, hope the following can give you some hints.
    Standard API for Dynamics 365 Business Central SaaS (Get, Post, Patch, Delete and Basic query parameters – filter, orderby, select…)
    Where is cloud(SaaS) data actually stored (Get BC public IP address, City, Region, Country, Location etc.)
    Dynamics 365 Business Central Blog Series: Integrate Business Central with SharePoint
     
    Thanks.
    ZHU
  • Suggested answer
    Sohail Ahmed Profile Picture
    11,169 Super User 2026 Season 1 on at
    Hope this will help you to understand basics of AL HTTP POST
     
     
     
    ✅ Mark this as the verified answer if helpful.
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    22,130 Super User 2026 Season 1 on at
    Business Central can make POST API calls directly using HttpClient in AL. You don’t need an Azure Function unless the target API requires something BC can’t handle.
  • Gregory Mavrogeorgis Profile Picture
    992 Super User 2026 Season 1 on at
    You can test the API first in Postman to confirm the headers and payload work. Then in AL, use HttpClient, HttpHeaders, and HttpContent to build the request. Serialize your payload with JsonObject and send it via Client.Post(). Start simple—Postman helps a lot before coding the call.
  • Suggested answer
    Sumit Singh Profile Picture
    11,757 Super User 2026 Season 1 on at
    Hi, 
     
    BC can send HTTP POSTs directly from AL using HttpClient. I don’t think that you need an Azure Function.
    I am attaching a sample for your reference.
    Notes
    • Enable outbound calls per app: Extension Management → Configure → Allow HttpClient Requests.
    • HttpClient, HttpContent, HttpHeaders, HttpResponseMessage, JsonObject are the standard AL types for REST calls.
    • To subscribe on insert, use the OnAfterInsertEvent table trigger (as shown).
    • If your helpdesk API uses OAuth2, follow the Microsoft Learn guidance to obtain tokens before calling the API.
    Official docs Mark the Boolean true “Does this answer your Question” if this was Helpful.
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,005 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,148 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 557 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans