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"){} } } } }
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
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,151 Super User 2024 Season 2
Martin Dráb 229,963 Most Valuable Professional
nmaenpaa 101,156