How to use an API in Dynamics 365 Business Central?

In basic terms, APIs just allow applications to communicate with each other. When people talk about “API”, they sometimes generalize and really mean “a publicly available web-based API that returns data, probably in JSON or XML”. The API is not the database, or even the server, but the code that governs the access points to the server. Let’s look at it in more detail

Imagine the following scenario: you want to access the data or functionality of another application. Perhaps you want to extract data for analysis or use it in other software. Then you would have to find a way to import that spreadsheet into your application; and, even if you stored it in a database, the data would become out of date very quickly.

It would be better and easier to have a way to query the application for that data, so that you could view it or use it in your own application automatically. In this way, it would be kept up to date automatically.

An API makes it easy for a different application to provide functionality or access to the data, so the data can be included in different applications.

What is an API?

An API (Application Programming Interface) is a tool that allows two different programs to communicate. In this case, Microsoft has published certain Web API or Web Services to communicate Business Central with third-party tools, always taking advantage of code that is already tested and works correctly. There is no need to carry out specific developments for each client’s connections.

The fact that Microsoft has defined the APIs means that they are now available to Business Central’s end users, and not just to its developers. The technical teams are focusing on developing data connectors so that end users can more easily access the data stored in the system while guaranteeing all security standards.

What can we say about Business Central’s APIs?

The APIs offered by Business Central allow you to consume and connect your ERP data to other tools, such as Excel, Power BI or Power Platform (Power Automate and Power Apps). You can also use them to connect Business Central to third party tools that are not related to Microsoft, for fast and secure data exchange.

In the following, we will show examples of how to work with Business Central APIs in Excel, Power BI and Power Platform.

First steps to work with APIs in Business Central

When we want to start working with this type of connections, one of the first questions we will ask ourselves is: Where do I find the data I need?

In the ‘Web Services’ page of Business Central you will find a list of available Web Services. You will have to identify which option in the list contains the information you need. Remember that you can rely on our infrastructure support team for this task.

 

Note that the URL contains information about the company and also about the page you are using.

When you have identified which option is the most convenient, you will have to copy the URL to insert the information in the corresponding tools. For example, let’s look at the case of Excel.

First, let’s insert the data:

We will need to copy the link provided by Business Central in Excel to continue. You can then proceed anonymously or by logging in to your organizational account, depending on how the API is configured.

Once you have passed this point, you will have access to the data contained in this API and it is time to take advantage of the power of Excel to work with the data using graphs, dynamic tables, dashboards, etc.

On the other hand, if we want to connect Business Central data from Power BI, we will have to perform a slightly different process, since as a source of data entry will already offer us the option to choose “Dynamics 365 Business Central”.

Connecting Business Central and Power Platform

Finally, we are going to exemplify how to connect Business Central data with the tools that make up the Power Platform. Business Central has its own specific standard connectors for these platforms (Power Automate and Power Apps). These connectors allow you to extract data as well as send data to Business Central.

In addition, you can select the API endpoints you need. API endpoints are the different types of data you can work with from Business Central.

In the case of Power Automate, for example, you also have predefined some of the triggers that initiate a flow.