Exam4Training

How should you complete the code segment?

HOTSPOT

You need to write the code to call the subcontractor’s REST API.

How should you complete the code segment? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point.

Answer:

Explanation:

To correctly write the code to call the subcontractor’s REST API, you would need to set the Authorization header with the base64 encoded username and password for basic authentication. The code segment indicates the use of the Base64Convert codeunit to convert the username and password to base64 format, which is then prefixed with "Basic " to form the proper Authorization header value.

The correct method to add the Authorization header to the RequestHeaders would be:

RequestHeaders.Add(‘Authorization’, ‘Basic ‘ + Base64Convert.ToBase64(Username + ‘:’ + Password));

And the correct method to set the httpContent with the body of the request would be:

httpContent.WriteFrom(Body);

These are the necessary steps to form a well-structured HTTP request for basic authentication and to include the body of the request in the API call.

Latest MB-820 Dumps Valid Version with 56 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Exit mobile version