Table of Contents

Search

  1. Preface
  2. Introduction to Business Entity Services
  3. EJB Business Entity Service Calls
  4. REST Business Entity Service Calls
  5. REST APIs for Data Director
  6. SOAP Business Entity Service Calls
  7. Cross-reference Records and BVT Calculations Services
  8. Supporting Corporate Linkage Service
  9. External Calls to Cleanse, Analyze, and Transform Data
  10. Appendix A: Using REST APIs to Add Records
  11. Appendix B: Using REST APIs to Upload Files
  12. Appendix C: Using REST APIs to Manage Reports

AJAX Call with HTTP Basic Authentication Example

AJAX Call with HTTP Basic Authentication Example

A call to business entity services requires HTTP basic authentication.
The following code shows an example of an AJAX call with HTTP basic authentication that uses jQuery:
<script type="text/javascript"> function readMeta(user, pass){ $.ajax({ type: "GET", url: "/cmx/cs/localhost-mdm-DS_UI1/Person?action=meta", dataType: 'json', async: false, headers: { "Authorization": "Basic " + btoa(user + ":" + pass) }, success: function (data) { alert('Data received! ' + data.object.label); } }); } </script>
In this example,
btoa
is a standard function that encodes a string in the Base64 format.
The developer who implements this call can decide how to pass the user name and password.
For the AJAX calls to be successful, host the JavaScript application on the same domain as the MDM Hub.

0 COMMENTS

We’d like to hear from you!