AJAX API Toolkit

AJAX API toolkit represents a single JavaScript class in single file. This file is already included in Platform pages to facilitate calling AJAX API functions. Simply declare the class and call functions in an on-page script as shown in the example below.

Note: This is an advanced feature that does require an understanding of JavaScript and the use of JavaScript classes.

JavaScript example:

// This may be called when some button is pressed
function sendAJAX(form) {
     var callback = function(responseText) {
          // Display or process returned XML document
     }

     var s = new API_Session(form.url.value, "intacct_dev", "babbage");
     s.ip_setCredentials("MCPMEGA_Platform", "Admin", "Aa123456!");

     // Call API toolkit function here
     s.ip_inspect("vendor", callback);
     return false;
}
</script>

Substitute call to inspect API by other call:

var arr = {"vendorid":"API_Vendor", "name": "API VENDOR [2]"};
s.ip_create('vendor', arr);

AJAX API Toolkit includes the following functions:

  • Constructor. Takes parameters:
    • ajaxURL: URL for API endpoint
    • senderid: Intact sender ID
    • senderpwd: Intacct sender password
    • controlid: Intacct control ID ("foobar" by default)
    • uniqueid: "false" by default
    • dtdversion: "3.0" by default
  • ip_setCredentials: sets user's credentials to perform calls. Parameters:
    • companyid: Intacct company ID
    • userid: user name
    • password: user password
  • ip_setSessionID: sets session ID for authentication. Once set, this session ID will be used to perform calls. Parameters:
    • sessionid: Intacct API session ID
  • ip_getLastRequest: returns last XML request sent to server. This function can be used for debugging.
  • ip_read: wrapper for API read function. Parameters:
    • object: object name
    • fields: comma-separated list of fields or *
    • keys: comma-separated list of keys to fetch
    • returnFormat: as described in API documentation
    • docparid: as described in API documentation
    • callback: JavaScript callback function. Will receive XML document returned by server as parameter.
  • ip_readByName: wrapper for API readByName function. Parameters:
    • object: object name
    • fields: comma-separated list of fields or *
    • keys: comma-separated list of keys to fetch
    • returnFormat: as described in API documentation
    • callback: JavaScript callback function. Will receive XML document returned by server as parameter.
  • ip_readByQuery: wrapper for API readByQuery function. Parameters:
    • object: object name
    • fields: comma-separated list of fields or *
    • query: query to use
    • pagesize: as described in API documentation
    • returnFormat: as described in API documentation
    • callback: JavaScript callback function. Will receive XML document returned by server as parameter.
  • ip_readMore: wrapper for API readMore function. Parameters:
    • object: object name
  • ip_readRelated: wrapper for API readRelated function. Parameters:
    • object: object name
    • keys: comma-separated list of keys to fetch
    • relation: as described in API documentation
    • fields: comma-separated list of fields or *
    • returnFormat: as described in API documentation
    • callback: JavaScript callback function. Will receive XML document returned by server as parameter.
  • ip_create: wrapper for API create function. Parameters:
    • object: object name
    • fieldsArray: JSON array of fields: field name -> field value
  • ip_createXML: wrapper for API createXML function. Parameters:
    • xmlPayload: XML text which may include several objects of arbitrary complexity to create
  • ip_update: wrapper for API update function. Parameters:
    • object: object name
    • fieldsArray: JSON array of fields: field name -> field value
  • ip_updateXML: wrapper for API updateXML function. Parameters:
    • xmlPayload: XML text which may include several objects of arbitrary complexity to update
  • ip_delete: wrapper for API delete function. Parameters:
    • object: object name
    • keys: comma-separated list of keys to delete
  • ip_inspect: wrapper for API inspect function. Parameters:
    • object: object name
    • callback: JavaScript callback function. Will receive XML document returned by server as parameter.

Comments

alex.gheorghe

AJAX API Toolkit - where is it supported?

Hello!

The AJAX toolkit seems to be a great tool! I haven't yet used it but I'm looking forward to.

Could you please let me know where is this functionality supported?

- internal pages a platform object

- internal pages of a standard object

- portal pages

- guest portal pages (where the portal user does not necesarry login into the portal)