OData v4 paginé par le serveur: lumnik suit @odata.nextLink
Objectif Lire les 120 clients d'un service OData v4 paginé par le serveur, comme Business Central, en pages de 20 demandées par Prefer, sans en perdre un.
Business Central pagine ses réponses OData côté serveur, et un client demande des pages plus petites avec Prefer: odata.maxpagesize. La page suivante n'est pas un paramètre calculé: c'est @odata.nextLink, une URL que le serveur renvoie.
- un vrai service ASP.NET Core OData v4
- le preset odata-v4, le total $count comme témoin
- six pages de 20, 120 clients
GET /odata/Customers?$count=true prefer=odata.maxpagesize=20 -> 200 GET /odata/Customers?$count=true&$skip=20 prefer=odata.maxpagesize=20 -> 200 GET /odata/Customers?$count=true&$skip=40 prefer=odata.maxpagesize=20 -> 200 GET /odata/Customers?$count=true&$skip=60 prefer=odata.maxpagesize=20 -> 200 GET /odata/Customers?$count=true&$skip=80 prefer=odata.maxpagesize=20 -> 200 GET /odata/Customers?$count=true&$skip=100 prefer=odata.maxpagesize=20 -> 200
manifests/10-customers.yaml
apiVersion: connectors.lumnik.io/v1kind: Connectormetadata: name: scenario-odata-customers-a connector_type: rest-generic scopes: [finance-a]spec: base_url: http://host.docker.internal:18073 headers: # Business Central pages at 20,000 by default; a client asks for smaller pages, as Microsoft documents. - { name: Prefer, value: odata.maxpagesize=20 } endpoints: - id: customers method: GET path: /odata/Customers?$count=true # $count: the total the run checks itself against pagination: { kind: odata-v4 } # @odata.nextLink, value, @odata.count target: kind: hybrid table: connector.scenario_odata_customers_a unique_key: $.Id promote: - { name: customer_no, path: $.No, type: text } - { name: name, path: $.Name, type: text } - { name: city, path: $.City, type: text } - { name: balance, path: $.Balance, type: decimal }$ lm apply -f 10-customers.yaml
Applied connector "scenario-odata-customers-a" — 1 endpoint
$ lm source rest test scenario-odata-customers-a
ENDPOINT METHOD STATUS ITEMS VERDICT
customers GET 200 20 ok
$ lm connector run scenario-odata-customers-a
run scheduled: cc998932-2d44-40d5-a18f-72c3ea626254
$ lm run get cc998932-2d44-40d5-a18f-72c3ea626254 --wait-evaluated
ID CONNECTOR ENDPOINT STATUS IN OUT SKIPPED DEAD-LETTERS STARTED ENDED EVALUATED
cc998932 scenario-odata-customers-a customers Completed 120 120 0 0 2026-11-21 21:22 2026-11-21 21:22 yes- without Prefer
- 50 items · @odata.count 120 · nextLink …$count=true&$skip=50
- the server's log
- 6 × GET /odata/Customers, Prefer: odata.maxpagesize=20
- run
- IN 120 · OUT 120 · DEAD-LETTERS 0
preuves: replay.log, 01-first-page.json, 02-preflight.txt, 03-run.json, 04-server-requests.txt · transform v1
Limites
- Ce n'est pas Business Central: c'est le framework OData publié par Microsoft, qui pagine de la même façon. L'authentification OAuth2 de Business Central n'est pas montrée ici.
- Un serveur peut ignorer Prefer: la taille de page est alors la sienne, et le run suit toujours le lien.
- 120 clients synthétiques.
Ce scénario tourne sur lumnik Open, gratuit et open source.
Essayer lumnik Open →