MB-820 practice question 11 of 25

A company has a Business Central online environment. You need to create an HTTP GET request that connects to an external REST service. Which solution should you use?

Full set: 116 questions

Domain Configure Microsoft Dynamics 365 Business Central

Answer options
A: HttpContent data type variable
B: Codeunit 1299 "Web Request Helper"
C: Codeunit S459 "JSON Management"
D: Codeunit 1297 "Http Web Request Mgt”
E: HttpClient data type variable Correct answer
Correct Answer:
E. HttpClient data type variable
Explanation

The HttpClient data type is the standard and recommended component in the AL language for sending HTTP requests and receiving responses from external web services. It provides specific methods for different HTTP verbs, including a .Get() method designed explicitly for making HTTP GET requests. To connect to an external REST service, a developer would instantiate an HttpClient variable and use its methods to perform the required communication. This is the most direct and modern approach within Business Central for this task.

Why Incorrect

A. The HttpContent data type is used to represent the body or payload of an HTTP request (e.g., for POST or PUT), not to initiate the request itself.
B. Codeunit 1299 "Web Request Helper" is a wrapper/helper object. The fundamental and recommended approach is to use the HttpClient data type directly for better control and clarity.
C. Codeunit S459 "JSON Management" is used for creating, parsing, and manipulating JSON data structures, not for performing the actual network communication via HTTP.
D. Codeunit 1297 "Http Web Request Mgt" is a legacy helper codeunit. The HttpClient data type is the current, more powerful, and recommended tool for HTTP communication.

References

1. Microsoft Learn: "HttpClient Data Type".

Section: Remarks.

Content: "Provides a data type for sending HTTP requests and receiving HTTP responses from a resource identified by a URI." This document explicitly states that HttpClient is the primary data type for this purpose and provides examples of using the .Get() method.

2. Microsoft Learn: "Calling external web services with the HttpClient data type in AL".

Section: "Example: Making a GET request".

Content: This tutorial demonstrates the end-to-end process, starting with the declaration of an HttpClient variable (Client: HttpClient;) to make a GET request to a REST API.

3. Microsoft Learn: "HttpContent Data Type".

Section: Remarks.

Content: "Represents the body of the HTTP request message." This confirms that HttpContent is for the payload, not the client sending the request.

Scroll to Top