Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Post Data to Business Central Standard API [purchaseOrders]

(3) ShareShare
ReportReport
Posted on by 21

Hi, I need to create a purchase order using Postman with the standard API:

https://api.businesscentral.dynamics.com/v2.0/{tenantID}/{Sandboxname}/api/v2.0/purchaseOrders?$expand=purchaseOrderLines

My main blocker is that I need to post data into the field named "Item Reference No" in the purchase line. As per the Business Central community dev suggestion, I should use "ItemVariant". Here is how the body looks:

{

    "number": "Postman6",

    "orderDate": "2025-01-14",

    "postingDate": "2025-01-14",

    "vendorNumber": "100",

    "purchaseOrderLines": [

        {

            "lineType": "Item",

            "lineObjectNumber": "100",

            "description": "Item 1",

            "quantity": 2,

            "itemVariant": "TL-001"

        },

        {

            "lineType": "Item",

            "lineObjectNumber": "100",

            "description": "Item 2",

            "quantity": 1

        }

    ]

}

However, it is giving an error.

 

Even when I use the standard API for the line:

https://api.businesscentral.dynamics.com/v2.0/{tenantid}/Dev-Sandbox/api/v2.0/purchaseOrderLines(84c12e62-6e94-ef11-8a6b-6045bdd59b7e)

I can't see any key that references "Item Reference No".

Can someone help me with this issue?


do i need to register the Item Reference No field by making standard API copy make my changes like here they have done it : - https://www.kauffmann.nl/2021/03/12/extending-standard-apis-1/

 

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 76,297 Super User 2024 Season 2 on at
    Post Data to Business Central Standard API [purchaseOrders]
    Hi, hope the following can give you some hints.
    Dynamics 365 Business Central: Can we extend standard APIs? – Download Standard Source Code for APIs
     
    Thanks.
    ZHU
  • Suggested answer
    Satish Srivastava Profile Picture
    Satish Srivastava 110 on at
    Post Data to Business Central Standard API [purchaseOrders]
    Hi ,
     
    In Microsoft Dynamics 365 Business Central, the Purchase Order API is based on the Purchase Order Page. Since we cannot directly modify the standard API, we need to extend the standard Purchase Order page using AL Language.
     
    follow the below steps.
     
     
    * Write a Page Extension to add the Item Reference No. field to the Purchase Order Page.
    * Re-Publish the Standard Purchase Order API
    * Verify the API Schema (Check for "Item Reference No.")
     
    Thanks
    Satish Srivastava

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Share Your Event with the Community

Jump start your event engagement! 📢

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,646 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans