Here’s a example of how to post Assembly orders and lines and add item tracking to the lines and header via Odata web services in Business Central.

First API page to create/read/update assembly orders:

page 50130 AssemblyOrders
{
    PageType = API;
    APIGroup = 'BCPortal';
    APIPublisher = 'BCPortal';
    APIVersion = 'v1.0';
    EntitySetName = 'assemblyOrders';
    EntityName = 'assemblyOrder';
    DelayedInsert = true;
    SourceTable = "Assembly Header";

    layout
    {
        area(Content)
        {
            repeater(AssemblyHeader)
            {
                field(SystemId; Rec.SystemId)
                {
                    Caption = 'System Id';
                }
                field(Status; Rec.Status) { }
                field(Description; Rec.Description) { }
                field("No"; Rec."No.")
                {
                    Caption = 'Customer No.';
                }
                field("ItemNo"; Rec."Item No.")
                {
                    Caption = 'Item No.';
                }
                field("DueDate"; Rec."Due Date")
                {
                    Caption = 'Due Date';
                }
                field("EndingDate"; Rec."Ending Date")
                {
                    Caption = 'Ending Date';
                }
                field("PostingDate"; Rec."Posting Date")
                {
                    Caption = 'Posting Date';
                }
                field("StartingDate"; Rec."Starting Date")
                {
                    Caption = 'Starting Date';
                }
                field("DocumentType"; Rec."Document Type")
                {
                    Caption = 'Document Type';
                }
                field(Quantity; Rec.Quantity)
                {

                }
                field("QuantityBase"; Rec."Quantity (Base)")
                {

                }
                field("QuantityToAssemble"; Rec."Quantity to Assemble") { }
                field("AssembledQuantity"; Rec."Assembled Quantity") { }
                field("AssembledQuantityBase"; Rec."Assembled Quantity (Base)") { }
                field("RemainingQuantity"; Rec."Remaining Quantity") { }
                field("RemainingQuantityBase"; Rec."Remaining Quantity (Base)") { }
                field("QtyPerUnitOfMeasure"; Rec."Qty. per Unit of Measure") { }
                part(AssemblyLines; "Assembly Order Subform")
                {
                    ApplicationArea = All;
                    Caption = 'Lines', Locked = true;
                    EntityName = 'assemblyOrderLine';
                    EntitySetName = 'assemblyOrderLines';
                    SubPageLink = "Document No." = field("No.");
                }
            }
        }
    }

    [ServiceEnabled]
    procedure PostAssemblyOrder(var actionContext: WebServiceActionContext)
    begin
        Codeunit.run(Codeunit::"Assembly-Post", Rec);
        actionContext.SetObjectType(ObjectType::Page);
        actionContext.SetResultCode(WebServiceActionResultCode::Updated);
    end;
}

This is pretty standard web api that exposes assembly header and lines as a web service. It also includes a method to post the order.

Second page to update lot no’s(item tracking) on the assembly lines and orders:

page 50131 ItemTracking
{
    PageType = API;
    APIGroup = 'BCPortal';
    APIPublisher = 'BCPortal';
    APIVersion = 'v1.0';
    EntitySetName = 'itemTrackings';
    EntityName = 'itemTracking';
    DelayedInsert = true;
    SourceTable = "Reservation Entry";
    SourceTableTemporary = true;

    layout
    {
        area(Content)
        {
            repeater(ReservEntry)
            {
                field("QuantityBase"; "Quantity (Base)") { }
                field("ItemTracking"; "Item Tracking")
                {
                    trigger OnValidate()
                    begin
                        rec."Item Tracking" := rec."Item Tracking"::"Lot No.";
                    end;
                }
                field("EntryNo"; "Entry No.")
                {
                    trigger OnValidate()
                    begin
                        rec."Entry No." := rec.GetLastEntryNo() + 1;
                    end;
                }
                field("ReservationStatus"; "Reservation Status")
                {
                    trigger OnValidate()
                    begin
                        rec."Reservation Status" := rec."Reservation Status"::Surplus;
                    end;
                }
                field("CreationDate"; "Creation Date")
                {

                }
                field("ShipmentDate"; "Shipment Date") { }
                field("ItemNo"; "Item No.") { }
                field("LocationCode"; "Location Code") { }
                field("SourceType"; Rec."Source Type")
                {
                    trigger OnValidate()
                    begin
                        Rec."Source Type" := Rec."Source Type";
                    end;
                }
                field("SourceSubtype"; "Source Subtype") { }
                field("SourceID"; "Source ID") { }
                field("SourceRefNo"; "Source Ref. No.") { }
                field("LotNo"; "Lot No.") { }
                field("QtyperUnitofMeasure"; "Qty. per Unit of Measure") { }
                field(Positive; Positive) { }
                field(Description; Description) { }
            }
        }
    }

    trigger OnInsertRecord(BelowxRec: Boolean): Boolean
    var
        CreateReservEntry: Codeunit "Create Reserv. Entry";
    begin

        CreateReservEntry.SetDates(0D, rec."Expiration Date");

        CreateReservEntry.CreateReservEntryFor(
            Rec."Source Type",
            Rec."Source Subtype",
            Rec."Source ID",
            Rec."Source Batch Name",
            rec."Source Prod. Order Line",
            Rec."Source Ref. No.",
            Rec."Qty. per Unit of Measure",
            0,
            Rec."Quantity (Base)",
            Rec
        );

        CreateReservEntry.CreateEntry(
            Rec."Item No.",
            Rec."Variant Code",
            Rec."Location Code",
            '',
            0D,
            Rec."Shipment Date",
            0,
            Rec."Reservation Status"
        );

    end;
}

This examples are very simplistic and won’t work with all cases but they work for posting some basic assembly orders with item tracking.

Hope it helps someone working on these problems.