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

Custom Payload in Business Central API

(4) ShareShare
ReportReport
Posted on by 50
Hi All,
 
I have a requirement that needs BC to provide a payload that's unusual from standard API page.
 
So, my third party application will need to pass json payload that looks like this:
 
I am thinking of using API page but doesn't have capability to have parts inside parts right?
If i were to use web services and publish codeunit, the third party must send a text format instead of jsonobject.
 
 
can help me how to achieve this requirements or any reference
 
Thanks
I have the same question (0)
  • Suggested answer
    Sohail Ahmed Profile Picture
    11,175 Super User 2026 Season 1 on at
    Why don't you use JSON OBJECT & JSON Array to create your JSON Body 
  • Suggested answer
    DAnny3211 Profile Picture
    11,421 Super User 2026 Season 1 on at

    Hello,

    Thank you for your question.

    You're correct that standard API pages in Business Central do not natively support deeply nested JSON structures (i.e., parts within parts). The API page model is designed for flat or moderately nested data and does not handle complex hierarchical payloads like the one you've described.

    Recommended Approach:

    1. Use a Codeunit with a Custom Web Service
      To handle complex JSON payloads, the most flexible and reliable method is to:

      • Create a codeunit that exposes a procedure accepting a Text or JsonObject parameter.
      • Publish the codeunit as a SOAP or OData web service.
      • Parse the incoming JSON manually using AL's JsonObject, JsonArray, and JsonToken types.

      This allows you to fully control how the payload is interpreted and mapped to internal data structures.

    2. Accept Raw JSON as Text
      If the third-party system cannot send a JsonObject, you can accept the payload as a Text parameter and parse it using JsonObject.ReadFrom(Text) within your codeunit.

    3. Avoid API Pages for Deep Nesting
      As you've noted, API pages are not suitable for this use case due to their limitations in handling nested collections. They are best used for standard CRUD operations with simple structures.

    4. Security and Validation
      Ensure that your codeunit includes proper validation, error handling, and authentication (e.g., via OAuth2 or API keys) to protect the endpoint.

    5. Alternative: Azure Function or Middleware
      If the payload structure is fixed and complex, consider using an Azure Function or middleware service to receive the payload, transform it into a format Business Central can consume, and then forward it via a simpler API call.

    If this response helps resolve your issue, please consider marking it as accepted so it may assist others with similar integration requirements.

    Best regards.

  • Suggested answer
    YUN ZHU Profile Picture
    100,974 Super User 2026 Season 1 on at
    Hi, hope the following helps.
    Business Central 2025 wave 1 (BC26): Overloaded JsonObject data type GetValue method (New methods access properties and array elements for JSON)
     
    Thanks.
    ZHU

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 April 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,086 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,290 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,218

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans