Introduction

Completed

A Business Central API is a contract between an extension and external applications. A dependable contract combines stable entities, explicit operations, suitable read routing, permissions, and protected credentials.

Connect the API design decisions

An integration surface can expose data through API pages and API queries. An API page represents an entity and can support create, read, update, and delete operations. An API query is a read-only projection that can join and aggregate data for reporting or synchronization scenarios.

Some business operations don't fit ordinary entity changes. A bound OData action operates on the entity identified in the request URL. An unbound OData action exposes a public codeunit procedure that isn't tied to a particular entity. These operations need predictable parameters, result behavior, permissions, and errors.

Read-heavy workloads introduce another decision. DataAccessIntent = ReadOnly declares that an API page or query doesn't require writes and can use a read-only database connection. When a replica is available, this intent can reduce work on the primary database. It doesn't guarantee replica routing, and a replica can lag behind the primary database.

API authentication credentials and outbound service secrets require separate handling. Business Central online APIs use OAuth 2.0 for caller authentication. If an extension also stores a credential for an outbound integration, isolated storage separates the value from other extensions, and SecretText limits exposure while AL code retrieves and uses it.

Follow the module scenario

In this module, you implement an integration surface for customer data. The solution includes a writable customer API, a read-only customer snapshot query, a customer-bound email operation, and an unbound lookup operation. You also add explicit permissions and a company-scoped credential store.

The exercise uses a Business Central online sandbox. Sandboxes accept the DataAccessIntent property but don't use Read Scale-Out replicas. You can verify the API contract and read-only behavior there, then document that replica-routing evidence belongs to a production environment where Read Scale-Out is available.

Apply the module objectives

By the end of this module, you can:

  • Select an API page or API query for an integration workload.
  • Implement bound and unbound OData V4 actions.
  • Apply and evaluate read-only data access intent.
  • Store and consume an extension secret without persisting it in source code or a regular table.

These capabilities let you design an API surface around explicit integration requirements rather than exposing user-interface objects as general-purpose services.