Exam MB-820 Topic 1 Question 42 Discussion

Actual exam question for Microsoft's MB-820 exam
Question #: 42
Topic #: 1
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.

Suggested 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.

by Donna at Dec 08, 2024, 09:28 PM

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

Contact Us

If you have any question please leave me your email address, we will reply and send email to you in 12 hours.

Our Working Time: ( GMT 0:00-15:00 ) From Monday to Saturday

Support: Contact now 

日本語 Deutsch 繁体中文 한국어