Creating a custom API in Dynamics 365 Business Central
With Dynamics 365 Business Central extensions, you can create custom entities and you can also expose those custom entities as RESTful APIs. Custom entities are entities that don’t exist in the standard product, which will be useful for you when you need an entity for a particular project or a particular customization.
To create a new API in Dynamics 365 Business Central, you need to define a new Page
object with PageType = API
. To do this, you can use the tpage
snippet and then select Page of type API, as follows:
Figure 13.20: Defining a new Page object
When creating API pages, remember the following:
- Fields must have a name in the REST API-compliant format (only alphanumeric values, and no spaces or special characters (
camelCase
)). - You should always expose the ID of the entity (
SystemId
) and this is the recommended OData key to use. - When you insert, modify, or delete an entity...