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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

What is the best approach for managing a POST HTTP API Request FROM Business Central TO an external destination

(0) ShareShare
ReportReport
Posted on by 32

Hi,

A client has a requirement whereby they need to submit a copy of a customers Sales Order, after it's entered in BC (v21.5), to the customer itself, via an POST HTTP API Request to a server hosted by the customer. 

The POST Request needs to be made in Xml format.

The details required within the Xml are fairly basic, eg:

  • Sales Order No., Shipment Date, Location Code from the Sales Header, and
  • Item No. and Quantity from the Sales Line

There are a couple more, but for the sake of simplicity I'll leave it at that.

I have built a fairly basic procedure against the Sales Header table to handle which is ok BUT... It's somewhat hard-coded and I'm sure there's a tidier and more flexible way I could have done. Must be able to use XMLPorts in some way to set-up the XML, rather than hard coding XMLElements and XMLAttributes etc.

I looked at Data Exchange Definitions also, but wasn't quite sure how to feed those into an POST HTTP API Request.

Keen to hear if anyone has some simple examples of setting up a POST HTTP API Request, using existing functionality (XMLPort, Data Exchange Definition, etc.) to build the Xml body, rather than coding as I have done. And maybe calling from a codeunit that could be set-up via Job Queue (currently I'm triggering mine from the Sales Order List page)

Also, does anyone know how to add a prefix to an XmlElement. Need to add "nsO" to the NameSpace element/node (e.g. 

<nsO:Submissiont xmlns:nsO="urn...">
  <Trans>
      ...
   </Trans>
</nsO:Submission>
Again I have achieved through hard code, but what's the proper use of the XmlNameSpace, XmlElement etc. functions to achieve this.
Haven't posted my code purposefully as I'm not looking for feedback on my current solution specifically, just any simple best practice examples people may have.
Thanks in advance.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 569 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 375 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 228 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans