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?