REST request

Additionally, in step 3 of our custom JavaScript extension, we used the cross-browser XMLHttpRequest (an API that helps communicate between client and server) to call the Dynamics 365 Web API endpoint. We opened the connection using the following line:

req.open("GET", requestUrl, true); 

The first parameter is a "verb" that defines we are performing a GET request to retrieve data using the constructed URL. The Boolean value at the end ensures that the request is performed asynchronously.

Asynchronous calls are the recommended way to call the Web API endpoint on the client side to ensure your pages are responsive.

The callback function is defined in the onreadystatechange element later in the code.

In setting up the request, we ensure that we are requesting the OData v4.0, and that we accept JSON.

The following lines of code ensure that we get the formatted value as it would appear on your screen:

req.setRequestHeader("Prefer", "odata.include-
annotations="OData.Community.Display.V1.FormattedValue"");

Finally, we send the request by executing the send() function.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.133.180