web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

How to call the code unit 90 Purch.-Post from the Rest API

(0) ShareShare
ReportReport
Posted on by 5

In Business Central under the webservices I have added the CodeUnit 90 "Purch.-Post" and named it PurchaseOrderPost

pastedimage1678178269365v1.png

From PostMan I'm trying to call the CodeUnit using the ODataV4 URL:

{{BusinessCentralURL}}/{{TenantId}}/{{Environment}}/ODataV4/PurchaseOrderPost

In the headers I pass the Company Id:

pastedimage1678178577602v2.png

I havn't found a way to pass the PurchaseOrder number or ID.

I'm using the OAuth 2.0 authorization

pastedimage1678178666178v3.png

The URL, TenantId and Environment are parameters, that are reused in multiple calls, for example:

{{BusinessCentralURL}}/{{TenantId}}/{{Environment}}/ODataV4/Company('CRONUS%20Danmark%20A%2FS')/PurchaseOrderPage?No='106001' - which works fine.

The response is "Resource not found for the segment 'PurchaseOrderPost'"

and looks like this:

pastedimage1678178785353v4.png

Has anybody successfully called the code unit 90 Purch.-Post? and would you please share how to?

I have the same question (0)
  • Suggested answer
    DAnny3211 Profile Picture
    11,397 on at

    hi

    try this

    Method: POST

    URI: api.businesscentral.dynamics.com/.../{MyNameWS}

    Authorization: Bearer + Access Token

    DAniele

  • KlausJuhl Profile Picture
    5 on at

    I tried with and without the ODataV4 in the URL, same result.

    Any suggestions on how to pass the Company and PuchaseOrder number/ID ?

  • Suggested answer
    Mohana Yadav Profile Picture
    61,005 Super User 2025 Season 2 on at

    I was able to successfully use the below

    api.businesscentral.dynamics.com/.../NAV.ReceiveAndInvoice

    I published 30066 page as purchaseOrders

  • KlausJuhl Profile Picture
    5 on at

    Thanks Mohana, I did consider this, but I only want to receive the lines, not invoice

    I'm looking for the equivalent to the first option in the purchase order booking popup (receive only):

    pastedimage1678190049676v1.png

  • Suggested answer
    Mohana Yadav Profile Picture
    61,005 Super User 2025 Season 2 on at

    then you may have to create a custom API page (copy of 30066 API) and set only receive to true in PostInvoice function

  • Suggested answer
    YUN ZHU Profile Picture
    95,681 Super User 2025 Season 2 on at

    Hi, as Mohana mentioned, you need to create a custom API at this time. Generally, there are two solutions.

    Creating and Interacting with an OData V4 Bound Action: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-creating-and-interacting-with-odatav4-bound-action

    Add custom execute actions: https://yzhums.com/20111/

    Hope this helps.

    Thanks.

    ZHU

  • ManishS Profile Picture
    86 on at

    you need to create a new codeunit were in you need to set all the values using events i.e. receive, what will be the purchase order number. After that call purchase post codeunit.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,606

#2
YUN ZHU Profile Picture

YUN ZHU 931 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 773 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans