Business Central provides a way to expose data to external applications out of the box. This is done via standard APIs. In this post, you will learn what are they, where to find them, and how to use them in Postman.
- What Are Standard APIs
- What APIs Are Available
- How To Use Standard APIs
- Can You Extend Standard APIs?
What Are Standard APIs
Standard APIs are a set of pre-built APIs that allow developers to access and manipulate data in Business Central from external applications or services.
These APIs are REST-based and can be used to perform various tasks such as creating, updating, deleting, and retrieving data. They can be authenticated using OAuth.
What APIs Are Available
To get a list of standard APIs you can:
- Make a request to the API 2.0 endpoint
- Access ‘Page Metadata’ table from Business Central
API 2.0 Endpoint Request
With Postman, you can send a request to the following endpoint.
The result will be a list of all available APIs 2.0 in your environment.
This is a fast way to check available APIs once you have set up OAuth. For setting up OAuth you can follow a detailed guide below.
Page Metadata Table
There is a faster way to get a list of APIs that you can do in Business Central. No need to use external tools.
There is a table in the base app called ‘Page Metada’ (2000000138). This table contains information of page objects of the base app. To see it, you need to add /?table=2000000138 after the URL after the environment name in your browser.
If we filter PageType = API you will be able to see them.
However, this table only shows list pages, not queries. For that, you should access ‘Query Metadata’ table (2000000142).
Keep in mind that on cloud this table can´t be seen with the URL as we did with ‘Page Metadata’, it´s only available on-premise. For that, you will need to create a custom page based on that table.
How To Use Standard APIs
On Microsft documentation, you will find how to create any request for the existing standard APIs.
You can take a look at them at the following link:
In this example, we will use the ‘companies’ standard API. You can find how to create a request to this API here:
It´s easy to build the endpoint, you just need to add ‘companies’ to the URL.
If you test it in Postman, you will get a list of companies in your environment:
Now, you can dig into the data of a specific company. You just need the ‘companyId‘. It´s the first field (“id”) you got in the previous request.
For example, with this endpoint, you will get a list of vendors of ‘CRONUS USA, Inc.’.
With the following result:
In this article, you can also follow a detailed step-by-step guide for testing APIs in Postman:
You can also take a look at Yun´s post where he teaches in detail how to make GET, POST, PATCH, and DELETE methods in Postman.
Can You Extend Standard APIs
If you need a field that is not included in a standard API you have to create your own API. You can´t extend standard APIs. That´s also true for personalized tables. The way to do it is via custom APIs.
Custom APIs are a simple way in which we can expose any data we need from Business Central. In the following guide, you will learn how to create and test custom APIs.
In conclusion, Business Central’s standard APIs provide a simple, secure and effective way of exposing data to external applications or services. Developers can use them to create, update, delete, and retrieve data from Business Central easily. Testing standard APIs is also straightforward, and if you need additional fields, you can create your own custom API.
That´s all. Hope you find it helpful.