Skip to main content

Notifications

Small and medium business | Business Central, N...
Unanswered

How to read data sent into body of API page from postman and create a sales order

Posted on by 10

Hi All,

I am new to AL Programming. I have created an API page in BC that saves data to an custom tables named "Sales Order" and "Sales Order Lines". I am calling this API  from postman and sending an json object to its body.  I am getting this data in custom tables properly.

I want to read this json object on api page and on behalf of the received data want to create a sales order. How can I achieve that. 

Thanks in advance.

Json object that I am sending in body from postman:

{

    "Order_ID""304563",
    "Custome_ID""20220818122121923",
    "Customer_Code""104",
    "VendInvNo""",
    "VendInvDateTm""2023-05-10T05:49:46Z",
    "WorkOrderNo""",
    "OrderStatus""Acknowledged",
    "ShipCompany""ANOKA-RAMSEY CC",
    "ShipFirstName""CHELSY LEE",
    "ShipLastName""",
    "ShipAddress""ROOM C159- RECEIVING",
    "ShipAddress2""11200 MISSISSIPPI B...",
    "ShipCity""COON RAPIDS",
    "ShipState""MN",
    "ShipPostalCode""55433",
    "ShipCountry""",
    "ShipPhoneNumber""411-1234",
    "TotalOrder"95.09,
    "ShippingMethod_ID""14",
    "Customer_PO""P0372987",
    "FreightCharge"0.0,
    "OrderComments""30447**P0372987**1480616949**887717432",
    "LineType_NAV""0",
    "Status_NAV""0",
    "SelltoCustomerNo_"null,
    "VendorOrderID""1480616949",
    "Terms""PO",
    "OrderDateTm""2023-05-10T05:49:46Z",
    "ShipDateTm""2023-05-10T05:49:46Z",
    "CreationDateTm""2023-05-10T05:49:46Z",
    "ExtraField"null,
    "TaxAmount"null,
    "SupplierID""1",
    "MiscChg1"0.0,
    "MiscChg2"0.0,
    "CustomerInvoiceNumber""",
    "Source""STANDARD ORDER",
    "SupplierAcctNo""887717432",
    "salesOrderLines": [
        {
            "Order_ID""304563",
            "OrderDetail_ID""41239",
            "Quantity"2,
            "UnitPrice"5.84,
            "BuyPrice"5.84,
            "DetailStatus""Acknowledged",
            "Punchout_LineNumber""1",
            "Punchout_Item_Number""1NXZ9",
            "Punchout_ManufacturerName""TOUGH GUY",
            "Punchout_ManufacturerPartID""1NXZ9",
            "Punchout_Classification""",
            "Punchout_Description"" Bench Brush Bristle Firmness Medium Bristle Material Synthetic Handle Material Foam Brush Length 9 in Handle Length 2 in Bristle Color Black Overall Length 14 3/8 in Chemical Resistant Yes Bristle Length 2 1/2 in Brush...",
            "Discount"null,
            "ExpectedShipDateTm""2023-05-09T00:00:00Z",
            "ItemCategory""N/A",
            "Status_NAV""1",
            "LineType_NAV""0",
            "VendInvLineUnitCost"0.0,
            "Import_Header_ID""0",
            "VendInvNo""",
            "VendInvDateTm"null,
            "VendInvLineQty"0,
            "CreationDateTm""2023-05-10T05:49:46Z",
            "CustomerInvoiceNo""",
            "AckStatus""accept",
            "Punchout_UoM""",
            "SupplierID""1",
            "SupplierAcctNo""887717432"
        },
        {
            "Order_ID""304563",
            "OrderDetail_ID""41240",
            "Quantity"2,
            "UnitPrice"5.84,
            "BuyPrice"5.84,
            "DetailStatus""Acknowledged",
            "Punchout_LineNumber""2",
            "Punchout_Item_Number""1NXZ9",
            "Punchout_ManufacturerName""TOUGH GUY",
            "Punchout_ManufacturerPartID""1NXZ9",
            "Punchout_Classification""",
            "Punchout_Description"" Bench Brush Bristle Firmness Medium Bristle Material Synthetic Handle Material Foam Brush Length 9 in Handle Length 2 in Bristle Color Black Overall Length 14 3/8 in Chemical Resistant Yes Bristle Length 2 1/2 in Brush...",
            "Discount"null,
            "ExpectedShipDateTm""2023-05-09T00:00:00Z",
            "ItemCategory""N/A",
            "Status_NAV""1",
            "LineType_NAV""0",
            "VendInvLineUnitCost"0.0,
            "Import_Header_ID""0",
            "VendInvNo""",
            "VendInvDateTm"null,
            "VendInvLineQty"0,
            "CreationDateTm""2023-05-10T05:49:46Z",
            "CustomerInvoiceNo""",
            "AckStatus""accept",
            "Punchout_UoM""",
            "SupplierID""1",
            "SupplierAcctNo""887717432"
        }
    ]
}

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans