Using Containments in Business Central OData Web Service
by
— August 18, 2020An overview of using Containments in Dynamics Business Central OData V4 Web Service.
As you maybe already know it's possible to publish some page in Dynamics Business Central as a web service. It's pretty easy but what if you would like to publish a page containing a subpage and you would like to publish it as OData V4 Web Service and in JSON format? Then you will need to know something about Using Containments and Associations.
Publish Sales Order Card page as OData V4 web service
Below you can find some example how to publish Sales Order Card page with Sales Order Lines subpage as OData V4 Web Service in JSON format.
Firstly, you need to publish Page 42 Sales Order as web service:
After that you should be able to open link for OData V4 web service, in our case it's http://insider:7048/BC/ODataV4/Company('My%20Company')/SalesOrder and you should see JSON formatted text with data related to Sales Order. Unfortunately, there is no information related to Sales Order Lines.
In order to see data for Sales Order Lines you need to modify the URL address for your published web service with $expand parameter as following: http://insider:7048/BC/ODataV4/Company('My%20Company')/SalesOrder?$expand=SalesOrderSalesLines
According to Microsoft Docs link above, you can also use the following link which will show you data for the specific Sales Order (data for header and lines): http://insider:7048/BC/ODataV4/Company('My%20Company')/SalesOrder(Document_Type='Order',No='101001')/SalesOrderSalesLines
Recent blog posts
26 Aug 2021 | User Experience in Business Central |
18 Aug 2020 | Using Containments in Business Central OData Web Service |
10 Jun 2020 | Price Calculation via AL Interface |
16 Nov 2019 | CI/CD with Azure DevOps video |
7 Nov 2018 | How to reverse Bank Account Statement Lines in Dynamics NAV |
1 Feb 2018 | A new version of Dynamics NAV 2018 Image Library |
11 Jan 2018 | Kill sessions in Microsoft Dynamics NAV 2018 |