Custom API objects can be created in order to add custom endpoints to the Business Central API. This allows you to not only surface custom data that you've added, but also to create customized views of all the data in the system.
The following object types can be exposed as API endpoints:
- Page
- Query
Creating the new endpoints is as easy as defining the page/query in your AL project as you normally would, and then defining a few specific properties:
Property | Value |
PageType/QueryType | The API |
APIPublisher | The name of the app publisher |
APIGroup | The name of the group the endpoint is in |
APIVersion | The version of the API the endpoint is exposed in |
EntityName | The singular name of the entity the endpoint exposes |
EntitySetName | The plural name of the entity the endpoint exposes |
Once the preceding properties are set, you define the fields that are part of the API object as you normally would, given the object type.
To access your custom endpoint, you would use the following URL structure:
endpoint/<apipublisher>/<apigroup>/<apiversion>/companies(<id>)/<entitysetname>