Speak GraphQL
Your customer's supplier exposes its order backbone as a GraphQL API — the same protocol Business Central's own first-party Shopify connector speaks. There is exactly one endpoint; every operation, reads included, is a POST whose JSON body carries the query text and a variables object. The previous integration attempt glued variable values straight into the query string and treated every HTTP 200 as success — until a renamed field turned every response into an errors-on-200 payload that the sync happily logged as "done". You are writing the replacement: a client that sends variables as typed JSON and reads the verdict where GraphQL actually puts it, in the response body.
Grading runs inside a container with no outbound network, so the round trip goes through a tiny seam — an interface whose production implementation would wrap HttpClient.Send, and whose grading implementation is a mock server the tests control. Everything up to that seam — method, URL, headers, body — is built exactly as if it were going to the real endpoint.
Requirements
Create an interface named "GraphQL Transport" with exactly this declaration:
interface "GraphQL Transport"
{
procedure Send(Request: HttpRequestMessage; var StatusCode: Integer; var ResponseBody: Text)
}Send performs the one HTTP round trip: it transmits the request and hands back the response's status code and body text. You do not implement it — the grading mock does (and production code would, with HttpClient).
Create an enum named "GraphQL Outcome" whose value names are exactly Success, Partial and Failed.
Create a codeunit named "GraphQL Response" with exactly these public procedures:
procedure Parse(Body: Text)
procedure Outcome(): Enum "GraphQL Outcome"
procedure Data(): JsonObject
procedure ErrorCount(): Integer
procedure ErrorMessage(Index: Integer): Text
procedure ErrorPath(Index: Integer): Text
procedure ErrorCode(Index: Integer): TextSolve 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
- 17 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.
Already on Pro? Sign in