Edit

Develop custom APIs with pages and queries

Note

We're working to improve the onboarding experience for AL developers. If you have feedback about this article, use the Feedback section at the bottom of the article to tell us what you'd like to see.

We also welcome contributions to our documentation. Learn more about contributing in Contribute to the help.

RESTful web services typically exchange data between Business Central and external systems. REST stands for Representational State Transfer. You can use any programming language that can call REST APIs. Business Central APIs provide versioned, OData v4-enabled REST endpoints for integrations.

Business Central includes built-in APIs that require no code and minimal setup. You can also develop custom APIs by using the AL object types API pages and API queries. This article helps you get started with API development.

Tip

Use the API Overview page in Business Central to explore published API pages, API queries, and API codeunits that are available in your environment. Learn more about the API Overview page in Discover APIs with the API Overview page.

Note

Extending API pages and queries isn't currently possible in Business Central.

Create APIs

When you create an API, consider how you intend to use it:

  • If you need to read and write data, use a page of the type API.
  • If you need a read-only joined or aggregated dataset from one or more tables, use a query of the type API.

The two approaches come with different characteristics as described in this table:

Method to expose data as an API Characteristics
API page Supports read-write operations
Supports webhooks
Can't be extended
Uses one source table per API page; nested API page parts can expose related entities from other tables
API query Supports read-only operations
Can't be extended
Can expose data from multiple tables

Tip

For inspiration and examples, see the open-source ALAppExtensions repository. The repository contains examples of API pages written in AL.

Get started with APIs

The following table includes links to help you get started with designing and working with APIs.

To See
Create APIs using an API page API pages
Create APIs using an API query API queries
Go through an example of how to develop a custom API page Walkthrough: developing a custom API
Learn how to create performant APIs API performance
Learn how to query APIs API client performance
Tips for working with APIs
Using filters with API calls
Troubleshoot API call failures Troubleshooting API calls
Monitor API calls with telemetry API telemetry
Explore built-in APIs REST API web services
Compare APIs with UI pages exposed as OData or SOAP web services Compare REST APIs, OData, and SOAP web services in Business Central

API page type
API queries
Walkthrough: Developing a custom API
Troubleshooting API calls
API performance
API client performance
Tips for working with APIs
Using filters with API calls
API telemetry
Built-in API overview
Web services overview (APIs, SOAP/OData)