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

Web API Query vs Page

(0) ShareShare
ReportReport
Posted on by 25

I have been using API Page to expose data and works well. see 50113 below.

I had a request to expose item data and this needs to create relationships to other tables. For example i need length so I need to create relationship to Item Unit of Measure table.

I don't see where its possible to do with on a API Page. Is this possible?

So I found out that API Queries can do this. see 50111 below
It also seems API Queries cannot handle more than one dataitem? I will have 3 that I need to setup.

The problem with this is I cannot use my header filters like I could with API Page. see image below.

The goal is for an external system to read the data from this API in a flat format. I would like the option to be able to filter on the requester side. Any advice?

page 50113 whseShipHeader
{
    APIGroup = 'AM';
    APIPublisher = 'Addie';
    APIVersion = 'v1.05';
    ApplicationArea = All;
    Caption = 'Warehouse Ship Header';
    DelayedInsert = true;
    EntityName = 'whseShipHeader';
    EntitySetName = 'whseShipHeader';
    PageType = API;
    SourceTable = "Warehouse Shipment Header";
    SourceTableView = sorting("No.") order(descending) WHERE("Completely Picked" = CONST(false));
    ODataKeyFields = SystemId;

    layout
    {
        area(content)
        {
            repeater(General)
            {
                field(systemId; Rec.SystemId)
                {
                    Caption = 'SystemId';
                }
                field(zoneCode; Rec."Zone Code")
                {
                    Caption = 'Zone Code';
                }
                field(completelyPicked; Rec."Completely Picked")
                {
                    Caption = 'Completely Picked';
                }
                field(status; Rec.Status)
                {
                    Caption = 'Status';
                }
                field(no; Rec."No.")
                {
                    Caption = 'No.';
                }
                field(shippingAgentCode; Rec."Shipping Agent Code")
                {
                    Caption = 'Shipping Agent Code';
                }
                field(documentStatus; Rec."Document Status")
                {
                    Caption = 'Document Status';
                }
                field(locationCode; Rec."Location Code")
                {
                    Caption = 'Location Code';
                }
                field(binCode; Rec."Bin Code")
                {
                    Caption = 'Bin Code';
                }
                field(systemCreatedAt; Rec.SystemCreatedAt)
                {
                    Caption = 'SystemCreatedAt';
                }
                field(externalDocumentNo; Rec."External Document No.")
                {
                    Caption = 'External Document No.';
                }
                part(WhseShptLine; "whseShipmentLines")
                {
                    Caption = 'Lines';
                    EntityName = 'whseShipmentLine';
                    EntitySetName = 'whseShipmentLines';
                    SubPageLink = "No." = Field("No.");
                }
            }
        }
    }
}

query 50111 perfionItemQ
{
    QueryType = API;
    APIGroup = 'AM';
    APIPublisher = 'Addie';
    APIVersion = 'v1.05';
    Caption = 'perfionItemQ';
    EntityName = 'perfionItemQ';
    EntitySetName = 'perfionItemQ';


    elements
    {
        dataitem(Item; Item)
        {
            DataItemTableFilter = Type = const(Inventory), "No." = filter('AMAR55180');
            column(No; "No.") { }
            column(Description; Description) { }
            column(UnitCost; "Unit Cost") { }
            column(GTIN; GTIN) { }
            column(Blocked; Blocked) { }
            column(ReplenishmentSystem; "Replenishment System") { }
            column(InventoryPostingGroup; "Inventory Posting Group") { }
            column(VendorNo; "Vendor No.") { }
            column(VendorItemNo; "Vendor Item No.") { }
            column(ItemCategoryCode; "Item Category Code") { }
            column(LastDateTimeModified; "Last DateTime Modified") { }


            dataitem(uom; "Item Unit of Measure")
            {
                DataItemLink = "Item No." = Item."No.";
                SqlJoinType = InnerJoin;
                DataItemTableFilter = "Code" = FILTER('Each');
                column(Length; Length) { }
                column(Width; Width) { }
                column(Height; Height) { }
                column(Cubage; Cubage) { }
                column(Weight; Weight) { }
            }

            dataitem(LAX_DP_Procurement_Unit;"LAX DP Procurement Unit")
            {
                DataItemLink = "Item No." = Item."No.", "Location Code" = Item."Location Filter";
                SqlJoinType = InnerJoin;
                column(RankingCode;"Ranking Code") { }
                column(ItemClassDescription;"Item Class Description"){}

            }



        }
    }

}

pastedimage1675255869640v1.png

I have the same question (0)
  • Suggested answer
    DAnny3211 Profile Picture
    11,417 Super User 2026 Season 1 on at

    Hi

    you can bind a subpage to the main page

    In your case the subpage would be the unit of measurement.

    in the api url to call the subpage you should add the following parameter:

    WSItem?$expand=NameEntitySubpage

    learn.microsoft.com/.../devenv-develop-custom-api

    check my answer if it helped you, thanks

    Daniele

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

#2
YUN ZHU Profile Picture

YUN ZHU 1,120 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 628 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans