topic hubIntegration & APIsofficial - Microsoftreviewed - checked by Opus

OData

OData web services in Business Central: how to consume them in JSON and AtomPub, read the metadata document, filter data, modify records, call V4 unbound actions, run transactional batches, and troubleshoot or tune calls. It answers questions on URI syntax, supported operations, known limits, error codes and client performance.

Path: Integration > Web services > OData · tier official · system integration · narrative reviewed (checked by Opus)

Overview

This section covers working with Business Central data through OData web services. It starts with the basics of consuming services: returning JSON or AtomPub (OData V3) documents, and getting the EDMX service metadata document that describes the entity data model. Containments and associations explain navigation between published pages.

Several pages cover querying and changing data. Filtering is described for OData URIs (with AL filter equivalents), for API/OData calls in general, and for FlowFilters on FlowFields. Data modification pages explain POST, PATCH and DELETE on writable pages, and OData V4 unbound actions let you call AL codeunit procedures published as web services. Transactional $batch requests group inner requests into one transaction.

For operations, use the performance guidelines, the troubleshooting page on error and HTTP status codes, the page on queries with a top number of rows, and the Known OData Limitations page. A sensible start is the metadata document and the filter pages, then data modification, then the limitations and performance pages.

Key points

  • JSON documents are consumed via URI parameters, with JSON-P callbacks supported; AtomPub documents apply to OData V3, including keyed entries and filtered feeds.
  • The EDMX service metadata document defines the entity data model, so tools such as LINQ can query Business Central data.
  • Writes use POST, PATCH and DELETE on writable pages; InsertAllowed, ModifyAllowed and DeleteAllowed control them, triggers run by operation type, and user permissions are enforced.
  • OData V4 unbound actions call AL codeunit procedures published as web services, using HTTP POST with JSON parameters and OAuth authentication.
  • Transactional $batch requests use the Isolation: snapshot header; if any inner request fails, all changes are reverted.
  • Performance guidance: Data-Access-Intent ReadOnly, batch requests, $select, $filter, $top and server-driven paging.
  • For queries with TopNumberOfRows, Max Page Size (odata.maxpagesize) must be greater than the TopNumberOfRows value to get correct counts.
  • Known limits include no PATCH on collection properties, no OR filters on distinct fields, no lambda operators, and no deep insert or deep patch.

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 14 Learn pages

Show 6 more