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

JavaScript Template

JavaScript Template

The following code sample shows a basic template that you can modify to create JavaScript code for REST business entity service calls. You need the jQuery java script library.
(function ($) { window.CSClient = window.CSClient || { baseUrl: "/cmx/cs/" + "[siperian-client.orsId]", user: "[siperian-client.username]", pass: "[siperian-client.password]", process: function (method, url, body, params) { var fullUrl = this.baseUrl + url + ".json?" + $.param(params); return $.ajax({ method: method, contentType: "application/json", url: fullUrl, data: JSON.stringify(body), beforeSend: function (xhr) { xhr.setRequestHeader("Authorization", "Basic " + btoa(CSClient.user + ":" + CSClient.pass)); } }); }, readCo: function (url, params) { return this.process("GET", url, null, params); }, createCo: function (url, body, params) { return this.process("POST", url, body, params); }, updateCo: function (url, body, params) { return this.process("PUT", url, body, params); }, deleteCo: function (url, params) { return this.process("DELETE", url, null, params); } }; })(jQuery);

0 COMMENTS

We’d like to hear from you!