How to Test API's in D365 Business Central

Prerequisite:

Business Central SaaS Tenant

Postman

How to configure Postman to connect to your Business Central tenant.

  1. The first step is to download the Postman app from the following site: 

https://www.getpostman.com/

  1. Next you will take note of the User Name and Web Service Access password in Business Central. Go to the Users Card and take note of the User Name and Web Service Access Key.

 

Note:  Unless you expand the window, you won’t be able to see the whole Web Service Access Key.  To make it easier to capture you can just click the key and press Ctrl + C.  You will be prompted that the “Field Value is Copied”.  When using this key, you will know it is successful if there is an equal sign (=) at the end of the key.

  1. In Postman you will click the Authorization tab and select Type: Basic Auth. You will enter in the Username and Password that you gathered from the User Card in Business Central.

 Now that Postman is configured with the User name and Web Service Password we will take this a step further and query different API’s in Business Central.  Below we will be building off each API from  getting specific Company lists to generating company specific filtered to a specific document.

GET addresses to use for the Business Central API:

 Available tables

https://api.businesscentral.dynamics.com/v2.0/<Azure AD tenant ID>/<ENVIRONMENT NAME>/api/v1.0/

As of the writing of this blog below are the available tables

 

How to get the list of Companies per tenant        

https://api.businesscentral.dynamics.com/v2.0/<Azure AD tenant ID>/<ENVIRONMENT NAME>/api/v1.0/companies

Below is what the results will look like in Postman.  Highlighted in yellow the “id” is the Company.

    “value”:

        {

            “id”: “b24ee78a-4605-476d-a692-f5ddee4b2285“,

            “systemVersion”: “36441”,

            “name”: “CRONUS USA, Inc.”,

            “displayName”: “CRONUS USA, Inc.”,

            “businessProfileId”: “”

How to call ALL Sales Invoices for a specific company

https://api.businesscentral.dynamics.com/v2.0/<Azure AD tenant ID>/<ENVIRONMENT NAME>/api/v1.0/companies(<CompanyID>)/salesInvoices

Note: You can replace /salesInvoices and enter /salesQuotes, /customers, etc to retrieve specific information.

How to filter to a specific Sales document

https://api.businesscentral.dynamics.com/v2.0/<Azure AD tenant ID>/<ENVIRONMENT NAME>/api/v1.0/companies(<CompanyID>)/salesInvoices?$filter=number eq ‘<Enter the Doc Number>’

                                                 

Helpful links:

This site is helpful for syntax questions:

https://github.com/Microsoft/api-guidelines/blob/master/Guidelines.md

Endpoint API’s for Business Central: 

https://docs.microsoft.com/en-us/dynamics-nav/api-reference/v1.0/endpoints-apis-for-dynamics    

Web Services and Multiple Production Environments with Dynamics 365 Business Central

https://cloudblogs.microsoft.com/dynamics365/it/2019/08/27/web-services-and-multiple-production-environments-with-dynamics-365-business-central/ 

- Advertisement -

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -

Latest News

Add and Edit Power BI data sources on Power Platform Admin Center

We are happy to announce that we have made enhancements to gateway management operations on Power Platform Admin center. We have added...
- Advertisement -

More Articles Like This

- Advertisement -