Table of Contents

Search

  1. Preface
  2. Introduction to Business Entity Services
  3. Enterprise Java Bean Business Entity Service Calls
  4. Representational State Transfer Business Entity Service Calls
  5. Simple Object Access Protocol Business Entity Service Calls
  6. Services for Cross-reference Records and BVT Calculations
  7. Supporting Corporate Linkage Service
  8. External Calls to Cleanse, Analyze, and Transform Data
  9. Using REST APIs to Add Records
  10. Using REST APIs to Upload Files

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!