Ava API Client

Guide

How to page through Business Central API results with @odata.nextLink

Updated 21 November 2026

Ask the Business Central API for every item or every ledger entry and you will not get them all in one response. The server stops at a page, and tells you where the next one is. Integrations that ignore that link quietly lose rows. This guide covers how the paging works, how to control the page size, when $top and $skip are the wrong tool, and how to keep large reads fast.

What a paged response looks like

GET .../companies(<company-id>)/generalLedgerEntries?$select=entryNumber,postingDate,amount

{
  "@odata.context": ".../$metadata#companies(...)/generalLedgerEntries(entryNumber,postingDate,amount)",
  "value": [
    { "@odata.etag": "W/\"...\"", "entryNumber": 1, "postingDate": "2025-01-02", "amount": 1250.00 },
    ...
  ],
  "@odata.nextLink": "https://api.businesscentral.dynamics.com/v2.0/.../generalLedgerEntries?$select=entryNumber,postingDate,amount&$skiptoken=..."
}

The rows are in value. When there are more than fit in one page, the response also has @odata.nextLink: a complete URL that returns the next page. When a response has no @odata.nextLink, you have the last page. That is the whole protocol.

This is called server-driven paging. The server decides where to cut, and the $skiptoken in the link is its bookmark. You never build or parse that token yourself; you request the URL exactly as given, with the same Authorization header as the first call.

The loop

  1. Send your first request, with whatever $filter, $select and $orderby you need.
  2. Process the rows in value.
  3. If the response contains @odata.nextLink, send a GET to that URL and go back to step 2.
  4. If it does not, stop.

Three details keep this robust. Keep the token fresh: a long export can outlive an access token, so check its expiry before each page rather than only at the start. Do not alter the link: adding or re-encoding query options can invalidate the $skiptoken. And treat the number of pages as unknown: a tenant with ten thousand items today has twelve thousand next year, and code that assumed one page breaks silently.

The most common paging bug is not a loop that fails. It is a loop that was never written. A test tenant fits in one page, the integration ships, and the first customer with more rows than a page gets an incomplete sync and no error. If an entity can grow, follow the link.

How big is a page?

Business Central Online serves pages of up to 20,000 rows by default. That is large enough that many lists never show a @odata.nextLink at all, which is exactly why the loop above gets forgotten. Entities that routinely exceed it are ledger entries, item ledger entries, dimension set entries and anything else that grows with every transaction.

You can ask for smaller pages with a Prefer header:

GET .../companies(<company-id>)/items
Prefer: odata.maxpagesize=500

If the server honours it, the response carries Preference-Applied: odata.maxpagesize=500 and pages are capped at 500 rows, each one with a @odata.nextLink to the next. Smaller pages mean more round trips but less memory, shorter individual calls that are less likely to hit a timeout, and faster time to the first row. For a background sync, a few hundred to a few thousand rows a page is a sensible range. The server may still return fewer rows than you asked for; always go by the presence of the link, not by counting rows.

$top and $skip: client paging, and why it bites

GET .../items?$orderby=number&$top=100
GET .../items?$orderby=number&$top=100&$skip=100
GET .../items?$orderby=number&$top=100&$skip=200

This also pages, and for a screen that shows "rows 101 to 200" it is the right shape. For reading a whole table it has three problems:

If you must use $skip, always pair it with $orderby on a field that is unique and does not change, such as number or entryNumber. Without an explicit order the server falls back to key order, which is usually stable but is a promise you have not asked for.

Counting without reading

GET .../customers?$count=true&$top=1
GET .../salesInvoices?$filter=status eq 'Open'&$count=true&$top=1

$count=true adds @odata.count to the response: the total number of rows the filter matches, whatever $top says. Use it to show progress ("12,400 of 38,000"), to decide whether to page at all, or to check at the end that you received as many rows as the server said there were. Counting a very large unfiltered table on every call has a cost of its own, so do it once per run rather than once per page.

Keeping large reads fast

Paging correctly is half the job. The other half is asking for less.

Select only the fields you store

$select=id,number,displayName,unitPrice,lastModifiedDateTime can cut the response to a fraction of its size and lets the server skip the columns you do not want. Wide entities such as customers, items and salesInvoices benefit most.

Filter on the server

Never download a table to filter it in code. $filter=postingDate ge 2026-01-01 moves the work to the database. The $filter examples cover the syntax for each type.

Sync by modification time

$filter=lastModifiedDateTime gt 2026-11-20T18:30:00Z&$orderby=lastModifiedDateTime

After the first full read, ask only for what changed since the last run. Store the newest lastModifiedDateTime you saw and use it as the next filter. Most entities in api/v2.0 have the field. Deletions are not reported this way; if you need them, compare keys periodically or use a deleted-records pattern on the Business Central side.

Avoid $expand on lists

$expand=salesOrderLines on one order is cheap. On a list of ten thousand orders it reads every line of every order and the page can take far longer than the same rows fetched as a separate paged read of the lines entity. Expand single records; page collections.

Prefer API pages to ODataV4 web services for bulk reads

Microsoft's guidance is that API pages, including custom ones, are designed for integration and perform better than exposing a UI page as an ODataV4 web service, because a UI page runs its triggers and calculates its FlowFields for every row.

Limits, throttling and timeouts

Microsoft publishes operational limits for Business Central Online: how many requests an environment accepts in a window, how many may run at the same time, and how long a single request may take before it is cut off. When you exceed the request limits the API answers 429 Too Many Requests, usually with a Retry-After header saying how long to wait. Honour it, then resume from the same @odata.nextLink; the link does not expire because you paused.

For long reads the practical advice is to run pages one after another rather than in parallel, to keep the page size moderate so no single call runs near the timeout, and to make your loop restartable, so that a failure on page 40 continues from page 40 and does not start again from page 1. Save the latest link along with your progress.

A worked example

Export every open sales invoice since the start of the year, 1,000 at a time, with only the fields an accounting system needs:

GET .../companies(<company-id>)/salesInvoices
  ?$filter=status eq 'Open' and invoiceDate ge 2026-01-01
  &$select=id,number,customerNumber,invoiceDate,dueDate,totalAmountIncludingTax,currencyCode
  &$orderby=invoiceDate,number
  &$count=true
Prefer: odata.maxpagesize=1000

Read @odata.count from the first page to know the total. Process value. While the response has @odata.nextLink, GET it with the same headers. When it does not, compare the rows you have with the count, and you are done.

The same thing in Ava

Ava sends one request at a time and does not follow @odata.nextLink for you, so a full export is still a loop you run elsewhere. What it does make easy is proving the paging before you write that loop. Add Prefer: odata.maxpagesize=5 in the Headers tab and send: with a small page you can see @odata.nextLink appear in the response, which you cannot on a list that fits in one page.

To step through pages by hand, add a Capture row that copies @odata.nextLink from the response body into a variable, then make a second request whose URL is {{nextLink}}. Send the first, then the second, and each send of the second request fetches the following page. A Test row on the body can check that @odata.nextLink does not exist on what should be the last page, or that @odata.count equals the number you expect, and a folder of such requests can be run together with the runner and its results read in one place. The query options themselves, $top, $count and the rest, live in the Params table, which stays in step with the URL bar as you edit either.

Sources