How to Create a Custom REST API in Business Central Cloud?

Here you can learn how to publish a REST API in Business Central. API can be used to integrate other applications into Business Central. API has more functionalities like deep insert rather than OData V4. Here are a few benefits of API as per below.

  • APIs are Webhook supported.
  • Namespaces supported so we can group and isolate our APIs as their functional area and scope.
  • Most important is that they have versioning (As you need a stable contract when doing integration. Microsoft also prevents extending standard API pages).

How to create and publish the API using the Page object

Follow the below steps for creating an API:

  1. Create a new Page and set value of “PageType” as “API“.
  2. Specify APIVersionAPIPublisherAPIGroupEntityName, and EntitySetName for your API page. These properties will affect your custom endpoint:
    https://api.businesscentral.dynamics.com/v2.0/<Tenant Id>/<Environment Name>/api/<API Publisher>/<API Group>/<API Version>/companies(<Company System Id>)/<Entity Set Name>
  3. Specify EntityCaption and EntitySetCaption. These two properties are generated in the entityDefinitions which are localized and translatable:
    https://api.businesscentral.dynamics.com/v2.0/<Tenant Id>/<Environment Name>/api/<API Publisher>/<API Group>/<API Version>/entityDefinitions
  4. Make sure to set the ODataKeyFields property to SystemId (If we want we can use primary key fields also):
    A SystemId field is a GUID data type field that specifies a unique, immutable (read-only) identifier for records in the table. It won´t be changed if the primary key of the record changes and that’s why recommends using SystemId. If we do not specify the ODataKeyFields as a property on the page, then Primary Key fields will be the default value.
  5. Must need to put the value as True for the DelayedInsert property of the page.
  6. After publishing the API page as an extension you can access it by OAuth 2.0 authentication.

I made a simple API for sales orders. Follow the below code:

page 50112 "Sales Order Web API"
{
    APIVersion = 'v1.0';
    APIPublisher='vidura';
    APIGroup='navuser';
    PageType = API;
    EntityCaption = 'SalesOrderAPI';
    EntitySetCaption = 'SalesOrdersAPI';
    EntityName = 'salesOrderAPI';
    EntitySetName = 'salesOrdersAPI';
    UsageCategory = Administration;
    SourceTable = "Sales Header";
    SourceTableView = WHERE("Document Type" = FILTER(Order));
    ODataKeyFields = SystemId;
    DelayedInsert = true;
    Extensible = false;
    layout
    {
        area(Content)
        {
            repeater(GroupName)
            {
                field("Id"; rec.SystemId){}
                field("No"; rec."No."){}
                field("SelltoCustomerNo"; rec."Sell-to Customer No."){}
                field("SelltoCustomerName"; rec."Sell-to Customer Name"){}
                part(salesOrderLines; "Sales Order Subform")
                {
                    ApplicationArea = All;
                    Caption = 'Lines', Locked = true;
                    SubPageLink = "Document Type"=FIELD("Document Type"),"Document No."=FIELD("No.");
                    EntityName = 'salesOrderLine';
                    EntitySetName = 'salesOrderLines';
                }
            }
        }
    }
}Code language: JavaScript (javascript)

Let’s try accessing the API by filtering a specific order by the “SystemId”

Here is the requested URL to filter specific order by the SystemId (0a251e29-df3a-ed11-bbae-6045bd8e554a) of the relevant record:

https://api.businesscentral.dynamics.com/v2.0/0224d299-271d-4ab6-8b5f-ff52b32ede8b/sandbox/api/vidura/navuser/v1.0/companies(86e811fb-de3a-ed11-bbae-6045bd8e554a)/salesOrdersAPI(0a251e29-df3a-ed11-bbae-6045bd8e554a)Code language: JavaScript (javascript)

Here is the reponse:

{
    "@odata.context": "https://api.businesscentral.dynamics.com/v2.0/0224d299-271d-4ab6-8b5f-ff52b32ede8b/sandbox/api/vidura/navuser/v1.0/$metadata#companies(86e811fb-de3a-ed11-bbae-6045bd8e554a)/salesOrdersAPI/$entity",
    "@odata.etag": "W/\"JzIwOzE0NTM3MDk2NzA1MTgzOTU4NTI0MTswMDsn\"",
    "Id": "0a251e29-df3a-ed11-bbae-6045bd8e554a",
    "No": "S-ORD101002",
    "SelltoCustomerNo": "10000",
    "SelltoCustomerName": "Adatum Corporation"
}Code language: JSON / JSON with Comments (json)

Note: If you did not mention the ODataKeyFields property on the page you have to pass “Document Type” and “No.” (Primary key) through the URL as per below.

https://api.businesscentral.dynamics.com/v2.0/0224d299-271d-4ab6-8b5f-ff52b32ede8b/sandbox/api/vidura/navuser/v1.0/companies(86e811fb-de3a-ed11-bbae-6045bd8e554a)/salesOrdersAPI('Order','S-ORD101002')Code language: JavaScript (javascript)

Accessing the API by filtering a specific order and expanding order lines

If you see the above response, there is no data on order lines (sub-page). If you want to receive data from any linked sub-page of the API page you have to mention it in the URL as per below.

https://api.businesscentral.dynamics.com/v2.0/0224d299-271d-4ab6-8b5f-ff52b32ede8b/sandbox/api/vidura/navuser/v1.0/companies(86e811fb-de3a-ed11-bbae-6045bd8e554a)/salesOrdersAPI(0a251e29-df3a-ed11-bbae-6045bd8e554a)?$expand=salesOrderLinesCode language: JavaScript (javascript)

salesOrderLines” is the Entity Name of the specified sub-page.

Here is the reponse:

{
    "@odata.context": "https://api.businesscentral.dynamics.com/v2.0/0224d299-271d-4ab6-8b5f-ff52b32ede8b/sandbox/api/vidura/navuser/v1.0/$metadata#companies(86e811fb-de3a-ed11-bbae-6045bd8e554a)/salesOrdersAPI/$entity",
    "@odata.etag": "W/\"JzIwOzE0NTM3MDk2NzA1MTgzOTU4NTI0MTswMDsn\"",
    "Id": "0a251e29-df3a-ed11-bbae-6045bd8e554a",
    "No": "S-ORD101002",
    "SelltoCustomerNo": "10000",
    "SelltoCustomerName": "Adatum Corporation",
    "salesOrderLines": [
        {
            "@odata.etag": "W/\"JzE5OzE5NDUwODQwODg5NjMzMjA5NTIxOzAwOyc=\"",
            "documentType": "Order",
            "Document_No": "S-ORD101002",
            "Line_No": 10000,
            "Type": "Item",
            "FilteredTypeField": "Item",
            "No": "1968-S",
            "Item_Reference_No": "",
            "ShpfyOrderNo": "",
            "IC_Partner_Code": "",
            "IC_Partner_Ref_Type": " ",
            "IC_Partner_Reference": "",
            "IC_Item_Reference": "",
            "Variant_Code": "",
            "Substitution_Available": true,
            "Purchasing_Code": "",
            "Nonstock": false,
            "VAT_Prod_Posting_Group": "",
            "Description": "MEXICO Swivel Chair, black",
            "Description_2": "",
            "Drop_Shipment": false,
            "Special_Order": false,
            "Return_Reason_Code": "",
            "Package_Tracking_No": "",
            "Location_Code": "",
            "Bin_Code": "",
            "Control50": "Optional",
            "Quantity": 10,
            "Qty_to_Assemble_to_Order": 0,
            "Reserved_Quantity": 0,
            "Unit_of_Measure_Code": "PCS",
            "Unit_of_Measure": "Piece",
            "Unit_Cost_LCY": 148.1,
            "SalesPriceExist": false,
            "Unit_Price": 190.1,
            "Tax_Liable": true,
            "Tax_Area_Code": "ATLANTA, GA",
            "Tax_Group_Code": "FURNITURE",
            "Line_Discount_Percent": 0,
            "Line_Amount": 1901,
            "Amount_Including_VAT": 2015.06,
            "SalesLineDiscExists": false,
            "Line_Discount_Amount": 0,
            "Prepayment_Percent": 0,
            "Prepmt_Line_Amount": 0,
            "Prepmt_Amt_Inv": 0,
            "Allow_Invoice_Disc": true,
            "Inv_Discount_Amount": 0,
            "Inv_Disc_Amount_to_Invoice": 0,
            "Qty_to_Ship": 10,
            "Quantity_Shipped": 0,
            "Qty_to_Invoice": 10,
            "Quantity_Invoiced": 0,
            "Prepmt_Amt_to_Deduct": 0,
            "Prepmt_Amt_Deducted": 0,
            "Allow_Item_Charge_Assignment": true,
            "Qty_to_Assign": 0,
            "Item_Charge_Qty_to_Handle": 0,
            "Qty_Assigned": 0,
            "Requested_Delivery_Date": "2022-05-02",
            "Promised_Delivery_Date": "0001-01-01",
            "Planned_Delivery_Date": "2022-05-02",
            "Planned_Shipment_Date": "2022-05-01",
            "Shipment_Date": "2022-05-01",
            "Shipping_Agent_Code": "FEDEX",
            "Shipping_Agent_Service_Code": "NEXT DAY",
            "Shipping_Time": "1D",
            "Work_Type_Code": "",
            "Whse_Outstanding_Qty": 0,
            "Whse_Outstanding_Qty_Base": 0,
            "ATO_Whse_Outstanding_Qty": 0,
            "ATO_Whse_Outstd_Qty_Base": 0,
            "Outbound_Whse_Handling_Time": "",
            "Blanket_Order_No": "",
            "Blanket_Order_Line_No": 0,
            "FA_Posting_Date": "0001-01-01",
            "Depr_until_FA_Posting_Date": false,
            "Depreciation_Book_Code": "",
            "Use_Duplication_List": false,
            "Duplicate_in_Depreciation_Book": "",
            "Appl_from_Item_Entry": 0,
            "Appl_to_Item_Entry": 0,
            "Deferral_Code": "",
            "Shortcut_Dimension_1_Code": "SALES",
            "Shortcut_Dimension_2_Code": "SMALL",
            "ShortcutDimCode3": "",
            "ShortcutDimCode4": "",
            "ShortcutDimCode5": "",
            "ShortcutDimCode6": "",
            "ShortcutDimCode7": "",
            "ShortcutDimCode8": "",
            "Gross_Weight": 15.99,
            "Net_Weight": 13.9,
            "Unit_Volume": 0.25,
            "Units_per_Parcel": 0,
            "Retention_Attached_to_Line_No": 0,
            "Retention_VAT_Percent": 0,
            "Custom_Transit_Number": "",
            "TotalSalesLine_Line_Amount": 0,
            "Invoice_Discount_Amount": 0,
            "Invoice_Disc_Pct": 0,
            "Total_Amount_Excl_VAT": 0,
            "Total_VAT_Amount": 0,
            "Total_Amount_Incl_VAT": 0
        },
        {
            "@odata.etag": "W/\"JzE4OzY2MDI2MjMwMDY2NDMwMDY4MzE7MDA7Jw==\"",
            "documentType": "Order",
            "Document_No": "S-ORD101002",
            "Line_No": 20000,
            "Type": "Item",
            "FilteredTypeField": "Item",
            "No": "1928-S",
            "Item_Reference_No": "",
            "ShpfyOrderNo": "",
            "IC_Partner_Code": "",
            "IC_Partner_Ref_Type": " ",
            "IC_Partner_Reference": "",
            "IC_Item_Reference": "",
            "Variant_Code": "",
            "Substitution_Available": false,
            "Purchasing_Code": "",
            "Nonstock": false,
            "VAT_Prod_Posting_Group": "",
            "Description": "AMSTERDAM Lamp",
            "Description_2": "",
            "Drop_Shipment": false,
            "Special_Order": false,
            "Return_Reason_Code": "",
            "Package_Tracking_No": "",
            "Location_Code": "",
            "Bin_Code": "",
            "Control50": "Optional",
            "Quantity": 7,
            "Qty_to_Assemble_to_Order": 0,
            "Reserved_Quantity": 0,
            "Unit_of_Measure_Code": "PCS",
            "Unit_of_Measure": "Piece",
            "Unit_Cost_LCY": 42.8,
            "SalesPriceExist": false,
            "Unit_Price": 54.9,
            "Tax_Liable": true,
            "Tax_Area_Code": "ATLANTA, GA",
            "Tax_Group_Code": "FURNITURE",
            "Line_Discount_Percent": 0,
            "Line_Amount": 384.3,
            "Amount_Including_VAT": 407.36,
            "SalesLineDiscExists": false,
            "Line_Discount_Amount": 0,
            "Prepayment_Percent": 0,
            "Prepmt_Line_Amount": 0,
            "Prepmt_Amt_Inv": 0,
            "Allow_Invoice_Disc": true,
            "Inv_Discount_Amount": 0,
            "Inv_Disc_Amount_to_Invoice": 0,
            "Qty_to_Ship": 7,
            "Quantity_Shipped": 0,
            "Qty_to_Invoice": 7,
            "Quantity_Invoiced": 0,
            "Prepmt_Amt_to_Deduct": 0,
            "Prepmt_Amt_Deducted": 0,
            "Allow_Item_Charge_Assignment": true,
            "Qty_to_Assign": 0,
            "Item_Charge_Qty_to_Handle": 0,
            "Qty_Assigned": 0,
            "Requested_Delivery_Date": "2022-05-02",
            "Promised_Delivery_Date": "0001-01-01",
            "Planned_Delivery_Date": "2022-05-02",
            "Planned_Shipment_Date": "2022-05-01",
            "Shipment_Date": "2022-05-01",
            "Shipping_Agent_Code": "FEDEX",
            "Shipping_Agent_Service_Code": "NEXT DAY",
            "Shipping_Time": "1D",
            "Work_Type_Code": "",
            "Whse_Outstanding_Qty": 0,
            "Whse_Outstanding_Qty_Base": 0,
            "ATO_Whse_Outstanding_Qty": 0,
            "ATO_Whse_Outstd_Qty_Base": 0,
            "Outbound_Whse_Handling_Time": "",
            "Blanket_Order_No": "",
            "Blanket_Order_Line_No": 0,
            "FA_Posting_Date": "0001-01-01",
            "Depr_until_FA_Posting_Date": false,
            "Depreciation_Book_Code": "",
            "Use_Duplication_List": false,
            "Duplicate_in_Depreciation_Book": "",
            "Appl_from_Item_Entry": 0,
            "Appl_to_Item_Entry": 0,
            "Deferral_Code": "",
            "Shortcut_Dimension_1_Code": "SALES",
            "Shortcut_Dimension_2_Code": "SMALL",
            "ShortcutDimCode3": "",
            "ShortcutDimCode4": "",
            "ShortcutDimCode5": "",
            "ShortcutDimCode6": "",
            "ShortcutDimCode7": "",
            "ShortcutDimCode8": "",
            "Gross_Weight": 4.03,
            "Net_Weight": 3.5,
            "Unit_Volume": 0.03,
            "Units_per_Parcel": 0,
            "Retention_Attached_to_Line_No": 0,
            "Retention_VAT_Percent": 0,
            "Custom_Transit_Number": "",
            "TotalSalesLine_Line_Amount": 0,
            "Invoice_Discount_Amount": 0,
            "Invoice_Disc_Pct": 0,
            "Total_Amount_Excl_VAT": 0,
            "Total_VAT_Amount": 0,
            "Total_Amount_Incl_VAT": 0
        },
        {
            "@odata.etag": "W/\"JzE5OzEzMTcyNzgxNTc1MjM5MTQ3NTYxOzAwOyc=\"",
            "documentType": "Order",
            "Document_No": "S-ORD101002",
            "Line_No": 30000,
            "Type": "G/L Account",
            "FilteredTypeField": "G/L Account",
            "No": "10100",
            "Item_Reference_No": "",
            "ShpfyOrderNo": "",
            "IC_Partner_Code": "",
            "IC_Partner_Ref_Type": " ",
            "IC_Partner_Reference": "",
            "IC_Item_Reference": "",
            "Variant_Code": "",
            "Substitution_Available": false,
            "Purchasing_Code": "",
            "Nonstock": false,
            "VAT_Prod_Posting_Group": "",
            "Description": "Checking account",
            "Description_2": "",
            "Drop_Shipment": false,
            "Special_Order": false,
            "Return_Reason_Code": "",
            "Package_Tracking_No": "",
            "Location_Code": "",
            "Bin_Code": "",
            "Control50": "Never",
            "Quantity": 0,
            "Qty_to_Assemble_to_Order": 0,
            "Reserved_Quantity": 0,
            "Unit_of_Measure_Code": "",
            "Unit_of_Measure": "",
            "Unit_Cost_LCY": 0,
            "SalesPriceExist": false,
            "Unit_Price": 0,
            "Tax_Liable": true,
            "Tax_Area_Code": "ATLANTA, GA",
            "Tax_Group_Code": "NONTAXABLE",
            "Line_Discount_Percent": 0,
            "Line_Amount": 0,
            "Amount_Including_VAT": 0,
            "SalesLineDiscExists": false,
            "Line_Discount_Amount": 0,
            "Prepayment_Percent": 0,
            "Prepmt_Line_Amount": 0,
            "Prepmt_Amt_Inv": 0,
            "Allow_Invoice_Disc": false,
            "Inv_Discount_Amount": 0,
            "Inv_Disc_Amount_to_Invoice": 0,
            "Qty_to_Ship": 0,
            "Quantity_Shipped": 0,
            "Qty_to_Invoice": 0,
            "Quantity_Invoiced": 0,
            "Prepmt_Amt_to_Deduct": 0,
            "Prepmt_Amt_Deducted": 0,
            "Allow_Item_Charge_Assignment": false,
            "Qty_to_Assign": 0,
            "Item_Charge_Qty_to_Handle": 0,
            "Qty_Assigned": 0,
            "Requested_Delivery_Date": "2022-05-02",
            "Promised_Delivery_Date": "0001-01-01",
            "Planned_Delivery_Date": "2022-05-02",
            "Planned_Shipment_Date": "2022-05-01",
            "Shipment_Date": "2022-05-01",
            "Shipping_Agent_Code": "FEDEX",
            "Shipping_Agent_Service_Code": "NEXT DAY",
            "Shipping_Time": "1D",
            "Work_Type_Code": "",
            "Whse_Outstanding_Qty": 0,
            "Whse_Outstanding_Qty_Base": 0,
            "ATO_Whse_Outstanding_Qty": 0,
            "ATO_Whse_Outstd_Qty_Base": 0,
            "Outbound_Whse_Handling_Time": "",
            "Blanket_Order_No": "",
            "Blanket_Order_Line_No": 0,
            "FA_Posting_Date": "0001-01-01",
            "Depr_until_FA_Posting_Date": false,
            "Depreciation_Book_Code": "",
            "Use_Duplication_List": false,
            "Duplicate_in_Depreciation_Book": "",
            "Appl_from_Item_Entry": 0,
            "Appl_to_Item_Entry": 0,
            "Deferral_Code": "",
            "Shortcut_Dimension_1_Code": "SALES",
            "Shortcut_Dimension_2_Code": "SMALL",
            "ShortcutDimCode3": "",
            "ShortcutDimCode4": "",
            "ShortcutDimCode5": "",
            "ShortcutDimCode6": "",
            "ShortcutDimCode7": "",
            "ShortcutDimCode8": "",
            "Gross_Weight": 0,
            "Net_Weight": 0,
            "Unit_Volume": 0,
            "Units_per_Parcel": 0,
            "Retention_Attached_to_Line_No": 0,
            "Retention_VAT_Percent": 0,
            "Custom_Transit_Number": "",
            "TotalSalesLine_Line_Amount": 0,
            "Invoice_Discount_Amount": 0,
            "Invoice_Disc_Pct": 0,
            "Total_Amount_Excl_VAT": 0,
            "Total_VAT_Amount": 0,
            "Total_Amount_Incl_VAT": 0
        },
        {
            "@odata.etag": "W/\"JzIwOzE0Mzk5OTY4MzgzODYwODYxNjA4MTswMDsn\"",
            "documentType": "Order",
            "Document_No": "S-ORD101002",
            "Line_No": 40000,
            "Type": " ",
            "FilteredTypeField": "Comment",
            "No": "MD",
            "Item_Reference_No": "",
            "ShpfyOrderNo": "",
            "IC_Partner_Code": "",
            "IC_Partner_Ref_Type": " ",
            "IC_Partner_Reference": "",
            "IC_Item_Reference": "",
            "Variant_Code": "",
            "Substitution_Available": false,
            "Purchasing_Code": "",
            "Nonstock": false,
            "VAT_Prod_Posting_Group": "",
            "Description": "Monthly Depreciation",
            "Description_2": "",
            "Drop_Shipment": false,
            "Special_Order": false,
            "Return_Reason_Code": "",
            "Package_Tracking_No": "",
            "Location_Code": "",
            "Bin_Code": "",
            "Control50": "Never",
            "Quantity": 0,
            "Qty_to_Assemble_to_Order": 0,
            "Reserved_Quantity": 0,
            "Unit_of_Measure_Code": "",
            "Unit_of_Measure": "",
            "Unit_Cost_LCY": 0,
            "SalesPriceExist": false,
            "Unit_Price": 0,
            "Tax_Liable": false,
            "Tax_Area_Code": "",
            "Tax_Group_Code": "",
            "Line_Discount_Percent": 0,
            "Line_Amount": 0,
            "Amount_Including_VAT": 0,
            "SalesLineDiscExists": false,
            "Line_Discount_Amount": 0,
            "Prepayment_Percent": 0,
            "Prepmt_Line_Amount": 0,
            "Prepmt_Amt_Inv": 0,
            "Allow_Invoice_Disc": true,
            "Inv_Discount_Amount": 0,
            "Inv_Disc_Amount_to_Invoice": 0,
            "Qty_to_Ship": 0,
            "Quantity_Shipped": 0,
            "Qty_to_Invoice": 0,
            "Quantity_Invoiced": 0,
            "Prepmt_Amt_to_Deduct": 0,
            "Prepmt_Amt_Deducted": 0,
            "Allow_Item_Charge_Assignment": false,
            "Qty_to_Assign": 0,
            "Item_Charge_Qty_to_Handle": 0,
            "Qty_Assigned": 0,
            "Requested_Delivery_Date": "2022-05-02",
            "Promised_Delivery_Date": "0001-01-01",
            "Planned_Delivery_Date": "2022-05-02",
            "Planned_Shipment_Date": "2022-05-01",
            "Shipment_Date": "2022-05-01",
            "Shipping_Agent_Code": "FEDEX",
            "Shipping_Agent_Service_Code": "NEXT DAY",
            "Shipping_Time": "1D",
            "Work_Type_Code": "",
            "Whse_Outstanding_Qty": 0,
            "Whse_Outstanding_Qty_Base": 0,
            "ATO_Whse_Outstanding_Qty": 0,
            "ATO_Whse_Outstd_Qty_Base": 0,
            "Outbound_Whse_Handling_Time": "",
            "Blanket_Order_No": "",
            "Blanket_Order_Line_No": 0,
            "FA_Posting_Date": "0001-01-01",
            "Depr_until_FA_Posting_Date": false,
            "Depreciation_Book_Code": "",
            "Use_Duplication_List": false,
            "Duplicate_in_Depreciation_Book": "",
            "Appl_from_Item_Entry": 0,
            "Appl_to_Item_Entry": 0,
            "Deferral_Code": "",
            "Shortcut_Dimension_1_Code": "SALES",
            "Shortcut_Dimension_2_Code": "SMALL",
            "ShortcutDimCode3": "",
            "ShortcutDimCode4": "",
            "ShortcutDimCode5": "",
            "ShortcutDimCode6": "",
            "ShortcutDimCode7": "",
            "ShortcutDimCode8": "",
            "Gross_Weight": 0,
            "Net_Weight": 0,
            "Unit_Volume": 0,
            "Units_per_Parcel": 0,
            "Retention_Attached_to_Line_No": 0,
            "Retention_VAT_Percent": 0,
            "Custom_Transit_Number": "",
            "TotalSalesLine_Line_Amount": 0,
            "Invoice_Discount_Amount": 0,
            "Invoice_Disc_Pct": 0,
            "Total_Amount_Excl_VAT": 0,
            "Total_VAT_Amount": 0,
            "Total_Amount_Incl_VAT": 0
        },
        {
            "@odata.etag": "W/\"JzE5OzExODY5OTk1MTU5Mzg1MjgwNzcxOzAwOyc=\"",
            "documentType": "Order",
            "Document_No": "S-ORD101002",
            "Line_No": 50000,
            "Type": "Fixed Asset",
            "FilteredTypeField": "Fixed Asset",
            "No": "FA000090",
            "Item_Reference_No": "",
            "ShpfyOrderNo": "",
            "IC_Partner_Code": "",
            "IC_Partner_Ref_Type": " ",
            "IC_Partner_Reference": "",
            "IC_Item_Reference": "",
            "Variant_Code": "",
            "Substitution_Available": false,
            "Purchasing_Code": "",
            "Nonstock": false,
            "VAT_Prod_Posting_Group": "",
            "Description": "erferfer",
            "Description_2": "",
            "Drop_Shipment": false,
            "Special_Order": false,
            "Return_Reason_Code": "",
            "Package_Tracking_No": "",
            "Location_Code": "",
            "Bin_Code": "",
            "Control50": "Never",
            "Quantity": 0,
            "Qty_to_Assemble_to_Order": 0,
            "Reserved_Quantity": 0,
            "Unit_of_Measure_Code": "",
            "Unit_of_Measure": "",
            "Unit_Cost_LCY": 0,
            "SalesPriceExist": false,
            "Unit_Price": 0,
            "Tax_Liable": true,
            "Tax_Area_Code": "ATLANTA, GA",
            "Tax_Group_Code": "NONTAXABLE",
            "Line_Discount_Percent": 0,
            "Line_Amount": 0,
            "Amount_Including_VAT": 0,
            "SalesLineDiscExists": false,
            "Line_Discount_Amount": 0,
            "Prepayment_Percent": 0,
            "Prepmt_Line_Amount": 0,
            "Prepmt_Amt_Inv": 0,
            "Allow_Invoice_Disc": false,
            "Inv_Discount_Amount": 0,
            "Inv_Disc_Amount_to_Invoice": 0,
            "Qty_to_Ship": 0,
            "Quantity_Shipped": 0,
            "Qty_to_Invoice": 0,
            "Quantity_Invoiced": 0,
            "Prepmt_Amt_to_Deduct": 0,
            "Prepmt_Amt_Deducted": 0,
            "Allow_Item_Charge_Assignment": false,
            "Qty_to_Assign": 0,
            "Item_Charge_Qty_to_Handle": 0,
            "Qty_Assigned": 0,
            "Requested_Delivery_Date": "2022-05-02",
            "Promised_Delivery_Date": "0001-01-01",
            "Planned_Delivery_Date": "2022-05-02",
            "Planned_Shipment_Date": "2022-05-01",
            "Shipment_Date": "2022-05-01",
            "Shipping_Agent_Code": "FEDEX",
            "Shipping_Agent_Service_Code": "NEXT DAY",
            "Shipping_Time": "1D",
            "Work_Type_Code": "",
            "Whse_Outstanding_Qty": 0,
            "Whse_Outstanding_Qty_Base": 0,
            "ATO_Whse_Outstanding_Qty": 0,
            "ATO_Whse_Outstd_Qty_Base": 0,
            "Outbound_Whse_Handling_Time": "",
            "Blanket_Order_No": "",
            "Blanket_Order_Line_No": 0,
            "FA_Posting_Date": "0001-01-01",
            "Depr_until_FA_Posting_Date": false,
            "Depreciation_Book_Code": "COMPANY",
            "Use_Duplication_List": false,
            "Duplicate_in_Depreciation_Book": "",
            "Appl_from_Item_Entry": 0,
            "Appl_to_Item_Entry": 0,
            "Deferral_Code": "",
            "Shortcut_Dimension_1_Code": "SALES",
            "Shortcut_Dimension_2_Code": "SMALL",
            "ShortcutDimCode3": "",
            "ShortcutDimCode4": "",
            "ShortcutDimCode5": "",
            "ShortcutDimCode6": "",
            "ShortcutDimCode7": "",
            "ShortcutDimCode8": "",
            "Gross_Weight": 0,
            "Net_Weight": 0,
            "Unit_Volume": 0,
            "Units_per_Parcel": 0,
            "Retention_Attached_to_Line_No": 0,
            "Retention_VAT_Percent": 0,
            "Custom_Transit_Number": "",
            "TotalSalesLine_Line_Amount": 0,
            "Invoice_Discount_Amount": 0,
            "Invoice_Disc_Pct": 0,
            "Total_Amount_Excl_VAT": 0,
            "Total_VAT_Amount": 0,
            "Total_Amount_Incl_VAT": 0
        }
    ]
}Code language: JSON / JSON with Comments (json)

Addtional: You can retrieve all data of orders expanding order lines as per below

https://api.businesscentral.dynamics.com/v2.0/0224d299-271d-4ab6-8b5f-ff52b32ede8b/sandbox/api/vidura/navuser/v1.0/companies(86e811fb-de3a-ed11-bbae-6045bd8e554a)/salesOrdersAPI?$expand=salesOrderLinesCode language: JavaScript (javascript)

And you can insert, modify, and delete data by using the other methods of the REST API.

Visit the previous guide about C# program to call web services with OAuth 2.0 authentication in BC.

Senior Solutions Architect - Microsoft Dynamics Navision / Microsoft Dynamics 365 Business Central and freelance developer. (The admin of NAVUSER)

Leave a Comment