Build a custom AL API page in Dynamics 365 Business Central to expose production order header and line data over OData v4 for an external MES integration
Create an AL extension; define a page of type API with properties APIPublisher, APIGroup (e.g., 'manufacturing'), APIVersion ('v1.0'), EntityName, and EntitySetName pointing to the Production Order table (Table 5405).
Add fields from the Production Order table (No., Description, Status, Source No., Quantity, Due Date) as part properties in the page.
Define a subpage of type API for production order lines (Table 5406 – Prod. Order Line) and link it via a part with SubPageLink = "Status" = FIELD(Status), "Prod. Order No." = FIELD(No.).
Publish the extension to a sandbox environment; the endpoint will be available at /api/<publisher>/<group>/v1.0/companies(<id>)/productionOrders.
Secure the endpoint by assigning the API permission set to the integration user; test with a GET request including $expand=productionOrderLines.
To allow status changes from the MES, add an OData action (bound function or unbound action via a Codeunit API) to transition the production order status — direct field writes on Status are blocked by business logic.
Known gotchas
The standard Business Central API v2.0 does not expose production order entities — manufacturing entities require a custom AL API extension or a third-party app; callers should not assume manufacturing data is available at the /api/v2.0/ path.
OData $filter on computed/FlowField columns (like remaining quantity) is not supported and returns an 'Internal server error' — only stored table fields can be used in $filter predicates on custom API pages.
Modifying the AL code of an existing published API changes the endpoint behavior for all consumers; Business Central has no built-in API versioning for custom endpoints beyond the APIVersion property — increment the version in both the publisher code and all client URL references simultaneously.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp