Use the following call to send a request.

    String method,
    Object params[,
    Function callback]

The function calls a REST method with specified parameters. The parameters (the params object) are passed as an associative array which will be converted to a POST request string. The possible array values include strings or references to the DOM form elements (see processing files below).

If this method is called prior to calling BX24.init, the request will be queued and postponed.


                {ID: 10}, 
                        var user =[0];
                        if (!!user)
                            alert('The name of the user #' + user.ID + ' is ' + user.NAME);

Attention! In Bitrix24 On-premise editions you can call REST methods using the method instead of BX24.callMethod().

Processing the request result

The result request handler is a callback function called after the request has been completed; it accepts the following ajaxResult instance:

  • = function() - the function returning the REST method response as an array, an object or a scalar. Refer to the method descriptions for further information.
  • Boolean|String ajaxResult.prototype.error = function() - returns the error description if an error occurred, or false otherwise.

Some methods may return data of substantial size, in which case data is returned in chunks as consequential arrays of 50 items (methods may override this value). Use the following methods to navigate the data chunks:

  • Boolean ajaxResult.prototype.more = function() - returns true if there is still data to fetch. Applicable to methods that return data.
  • Integer = function() - returns the total number of data records. Applicable to methods that return data.
  • Boolean|XMLHttpRequest|XDomainRequest = function([Function cb]) - requests and returns the next data chunk. The default behavior is return data to the same callback function, which can be overridden by passing another callback function as the cb argument.


The following code will return the list of users in screens of 50 records.

BX24.callMethod('user.get', {sort:'ID',order:'ASC'}, function(result) {
        if (result.error())
               alert('Request error: ' + result.error());
                if (result.more())

© «Bitrix24», 2001-2023