Introduction

Completed

Outbound REST integrations let a Business Central extension exchange data with services that own fulfillment, shipping, tax, or other business processes. A reliable integration defines the HTTP exchange and the JSON contract separately, then handles failures at each boundary.

Follow the outbound integration flow

An outbound integration begins in AL when a business action needs data from an external service or needs to submit data to that service. The extension creates an HTTP request, sends it through the Business Central platform, evaluates the response, and transforms the response body into AL values.

Each stage answers a different question:

  • Request design: Which HTTP method, URI, headers, and body does the service require?

  • Transport outcome: Did the Business Central platform complete the call?

  • HTTP outcome: Did the service accept and process the request?

  • Payload outcome: Does the response contain valid JSON with the properties and types that the extension expects?

A successful result at one stage doesn’t guarantee success at the next stage. For example, HttpClient.Send can return true while the service returns status 400. A service can also return status 200 with a body that omits a required property. Your AL code must evaluate each outcome in order.

Connect the AL type responsibilities

AL provides HTTP types for request and response processing and JSON types for payload processing. HttpClient sends the request. HttpRequestMessage, HttpContent, and HttpHeaders define the message. HttpResponseMessage exposes the service status, headers, and body. JsonObject, JsonArray, JsonToken, and JsonValue create or interpret the JSON body.

This module uses an external fulfillment scenario. You construct create and retrieve requests, distinguish platform failures from service failures, and validate the returned JSON before you use its values. The exercise uses a public REST test endpoint that doesn’t require credentials. Production integrations commonly add authentication, configuration, retry policies, telemetry, and automated tests around the same core pattern.

Apply the module objectives

By the end of this module, you can:

  • Select AL HTTP types for a REST request.

  • Send requests and interpret platform and HTTP outcomes.

  • Create and validate JSON objects and arrays.

  • Preserve useful diagnostic context when an integration fails.

The result is a repeatable boundary between Business Central business logic and an external REST contract.