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

Unable to Insert Data into Custom API with Nested Child Records (POST from Postman)

(6) ShareShare
ReportReport
Posted on by 50
Hi everyone, I'm creating a custom API in Business Central to insert a parent record (Car Brand) with child records (Car Models). I created an API page with a part control for the child entity:
 
page 50100 "API Car Brand"
{
    PageType = API;
    APIPublisher = 'bctech';
    APIGroup = 'demo';
    APIVersion = 'v1.0';
    EntityName = 'carBrand';
    EntitySetName = 'carBrands';
    SourceTable = "Car Brand";
 
    layout
    {
        area(content)
        {
            repeater(Group)
            {
                field(name; Rec.Name) { }
                field(description; Rec.Description) { }
                field(country; Rec.Country) { }
 
                part(carModels; "API Car Model")
                {
                    EntityName = 'carModel';
                    EntitySetName = 'carModels';
                    SubPageLink = "Brand Id" = Field(SystemId);
                }
            }
        }
    }
}
 
I published the page as a web service and tried to POST parent + child JSON from Postman:
 
{
  "name": "CARBRAND2",
  "description": "Car Brand 2",
  "country": "Germany",
  "carModels": [
    { "name": "MODELA", "description": "Model A", "power": 0, "fuelType": "Electric" }
  ]
}
 
But I receive this error:
 
"The property 'carModels' does not exist on type 'NAV.carBrands'. Make sure to only use property names that are defined by the type."
 
Could someone clarify whether nested write operations are supported in API pages, or if I need to create the child records in a separate request?
 
I have the same question (0)
  • Suggested answer
    Aman Kakkar Profile Picture
    2,977 Super User 2026 Season 1 on at
    Hi,
     

    Yes, nested write operations (deep inserts) are supported in API Pages in Business Central. The error you’re facing could be due to using the Web Service OAuth URL instead of the correct API URL that supports deep insert operations.

    Please make sure that both your Parent (Car Brand) and Child (Car Model) API pages include all the required properties as mentioned in Microsoft’s official documentation: Developing a custom API - Business Central | Microsoft Learn

    Also, ensure you’re using the correct API URL format. 
     
    https://api.businesscentral.dynamics.com/v2.0/<environmentName>/api/bctech/demo/v1.0/companies(<company id>)/carBrands(<car brand id>)?$expand=carModels
    

     

    Could you please share the following details as well?

    • The full code of your part page
    • The URL you’re using for your POST and GET request.

     

    This will help verify whether the issue lies in the page definition or in the endpoint setup.

    Hope this helps.
    Aman K
  • Suggested answer
    YUN ZHU Profile Picture
    99,055 Super User 2026 Season 1 on at
    Hi, hope the following can give you some hints.
     
    Thanks.
    ZHU
  • Suggested answer
    Rajkumar Samudrala Profile Picture
    50 on at
    The Full code for my part page is - 
    namespace Microsoft.API.V2;
    page 50101 "API Car Model"
    {
        PageType = API;
        APIVersion = 'v1.0';
        APIPublisher = 'bctech';
        APIGroup = 'demo';
        EntityCaption = 'CarModel';
        EntitySetCaption = 'CarModels';
        EntityName = 'carModel';
        EntitySetName = 'carModels';
        ODataKeyFields = SystemId;
        SourceTable = "Car Model";
        Extensible = false;
        DelayedInsert = true;
        layout
        {
            area(content)
            {
                repeater(Group)
                {
                    field(id; Rec.SystemId)
                    {
                        Caption = 'Id';
                        Editable = false;
                    }
                    field(name; Rec.Name)
                    {
                        Caption = 'Name';
                    }
                    field(description; Rec.Description)
                    {
                        Caption = 'Description';
                    }
                    field(brandId; Rec."Brand Id")
                    {
                        Caption = 'Brand Id';
                    }
                    field(power; Rec.Power)
                    {
                        Caption = 'Power';
                    }
                    field(fuelType; Rec."Fuel Type")
                    {
                        Caption = 'Fuel Type';
                    }
                }
            }
        }
        actions
        {
        }
    }
     
  • Suggested answer
    Rajkumar Samudrala Profile Picture
    50 on at

    I changed the URL to - https://api.businesscentral.dynamics.com/v2.0/88722ef3-08f7-447e-b322-1a23e0dcee28/api/bctech/demo/v1.0/companies('CRONUS%20IN')/carBrands?$expand=carModels
    But still I'm getting this error - {
        "error": {
            "code": "RequestDataInvalid",
            "message": "Request data is invalid."
        }
    }
    and the json I'm using is - 
    {
        "name": "CARBRAND2",
        "description": "Car Brand 2",
        "country": "Germany",
        "carModels": [{
                        "name": "MODELA",
                        "description": "Model A",
                        "power": 0,
                        "fuelType": "Electric"
                    },
                    {
                           "name": "MODELB",
                        "description": "Model B",
                        "power": 0,
                        "fuelType": "Electric"
                    }]
    }
  • Suggested answer
    Aman Kakkar Profile Picture
    2,977 Super User 2026 Season 1 on at
    Hi,
     

    Firstly, try changing the Company Name in your URL to the Company ID.

    Remove 'CRONUS%20IN' and replace it with the actual Id of your company.

    To find the Company ID

    1. Open the Companies page in Business Central.
    2. Press Ctrl + Alt + F1 (or use “Page Inspection”).
    3. Locate the Id field of the company record — that’s the value you should use in place of the company name.
     

     
    This should most likely resolve your issue. If not then, try below mentioned. 
     
    After updating the URL, if you still get the same error, try removing the $expand property and send a simpler request first.

    This will help confirm whether the error is coming from the Parent Page (Car Brand) or the Part Page (Car Model).

    Once that succeeds, you can add back the $expand=carModels to test deep inserts.

     

    Hope this helps.
    Aman K
  • Suggested answer
    OussamaSabbouh Profile Picture
    12,766 Super User 2026 Season 1 on at
    Hello,
     
    Nested POSTs (deep inserts) only work if your API exposes the child as a proper navigation property. The part control alone doesn’t do this, that’s why carModels isn’t recognized.
     
    Fix: use two POSTs (create carBrand, then POST carModels to /carBrands({id})/carModels), or redefine the API to expose the relationship per Microsoft’s deep insert sample.
     
    Regards,
    Oussama Sabbouh

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,926 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,158 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 533 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans