5053

Follow the nextLink

Integrations
Medium
Pro
interface
json
rest
pagination
odata

Follow the nextLink

Finance wants the total open amount across every supplier in your trading partner's REST feed. The intern's integration shipped last sprint and "worked perfectly" — because the test system had three suppliers and they all fit on one page. Production has hundreds, the feed serves them in pages, and each page points to the next one. The intern's version read the first page, never looked at @odata.nextLink, and piled its results on top of whatever the caller had left in the output parameters. You are writing the replacement from scratch: the pagination loop everyone writes badly once — follow the chain to the end, stop when it ends, and count nothing twice.

Grading runs inside a container with no outbound network, so the client never talks HTTP itself: it reads pages through a tiny seam — an interface whose production implementation would wrap HttpClient, and whose grading implementation is a mock feed the tests control. Your loop must not care where the pages come from.

Requirements

Create an interface named "Supplier Page Source" with exactly this declaration:

interface "Supplier Page Source"
{
    procedure GetPage(Url: Text): Text;
}

GetPage performs one GET against the feed and returns the raw JSON body of that page.

The rest of the statement and 3 hints Unlock with Pro
ALBusiness Central 28.5
Pro
Pro problem

Solve it with Pro

You’re reading the opening of the statement. Pro unlocks the whole problem:

  • The full statement
  • Starter code in the browser editor
  • 6 grading tests, run on Business Central 28.5
  • 3 hints
  • The reference solution

Pro also opens all 92 Pro problems and lifts the daily limits on compile checks and submissions.

$10 / month
or $100 / year
Upgrade
This problem is part of Pro
Pro unlocks the full statement, tests, hints and solution. The code editor works on a computer.
Upgrade