topic hubAL Developmentofficial - Microsoftreviewed - checked by Opus

Developing APIs

Developing APIs in AL for Business Central: API page and API query types, building custom REST/OData v4 endpoints, Connect app basics, filters, request tips, troubleshooting, performance and web service telemetry. It answers how to build, call, tune and diagnose web service APIs.

Path: Development > Programming in the AL language > Developing APIs · tier official · system development · narrative reviewed (checked by Opus)

Overview

This section covers building and consuming REST APIs in Business Central with AL. API pages give versioned, OData v4 enabled, webhook-capable endpoints with create, read, update and delete operations. API queries join data from several sources and expose it as read-only endpoints. Both use properties such as APIPublisher, APIGroup and APIVersion.

Start with “Develop APIs with Pages and Queries” for the overview, then “API page type” and “API query type” for the object types. “Developing a custom API” is a walkthrough for API pages: key fields, SystemId, entity names, relationships through parts and navigation properties, and moving away from the deprecated ODataEDMType complex types. “Get started developing Connect apps” covers authentication (Microsoft Entra ID with OAuth 2.0, or basic authentication with a web service access key) and exploring endpoints with Insomnia.

The remaining pages support day-to-day work with the APIs: tips on GET requests, Accept-Language, OData $batch and the Data-Access-Intent header; filter expressions; error and status code troubleshooting; performance patterns and anti-patterns; and web service telemetry for SOAP, OData and API traffic.

Key points

  • API page type creates versioned, OData v4 enabled REST endpoints with webhook support and CRUD; InsertAllowed and ModifyAllowed properties control writes.
  • API query type joins data from different sources and exposes it read-only, using APIPublisher, APIGroup and version properties.
  • The custom API walkthrough covers API v2.0 pages, ODataKeyFields, SystemId, EntityName, EntityCaption and EntitySetCaption, and parts and navigation properties for relationships.
  • Connect apps make point-to-point connections to partner solutions over REST APIs; authentication uses Microsoft Entra ID with OAuth 2.0 or basic authentication with a web service access key. The getting started guide refers to 2022 release wave 1.
  • API tips cover GET requests, Accept-Language for localization, transactional OData $batch with Isolation: snapshot, and the Data-Access-Intent header with ReadOnly. The tips page refers to 2020 release wave 2 (version 17.1).
  • Filtering follows Microsoft REST API guidelines, with property-based and range-based filter expressions.
  • Troubleshooting maps AL runtime exceptions to OData error codes and HTTP status codes, using the AL debugger and telemetry.
  • Performance depends on both the server endpoint and the consumer; guidance lists patterns, anti-patterns and Power BI considerations.

Learn pages

Videos, posts and code changes

Linked by a Haiku matcher with a grounding quote from the item’s summary (link/topics.ts); machine-generated.

Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.

What Learn documents here 8 of 10 Learn pages

Show 2 more