Documentation

lists.element.get

Scope: catalog Permissions to execute: for all

Description

lists.element.get(params)

This method returns list of elements or an element. If successful, returns data for element (-s), otherwise - returns an empty array.

Parameters

ParameterDescription
IBLOCK_TYPE_IDInformation block type ID (required):
  • lists - information block type for lists
  • bitrix_processes - information block type for processes
  • lists_socnet - information block type for group lists
SOCNET_GROUP_IDgroup ID (optional, when list is created for group);
IBLOCK_CODE/IBLOCK_IDcode or ID for information block (required);
ELEMENT_CODE/ELEMENT_IDcode or ID of the element (If not specified, it will return the list of all list elements)
ELEMENT_ORDERSorting. Array of information block section fields. Sorting direction: asc (in ascending order) or desc (by descending order). Example:
'ELEMENT_ORDER': { "ID": "DESC" } 

Sorting of all multiple properties is not supported, as well as the following properties: S:Money, PREVIEW_TEXT, DETAIL_TEXT, S:ECrm, S:map_yandex, PREVIEW_PICTURE, DETAIL_PICTURE, S:DiskFile, IBLOCK_SECTION_ID, BIZPROC, COMMENTS.
FILTERFiltration of elements. Object with list of fields and values. Almost all fields from the CIBlockElement::GetList list are available for filtration. For example, indicate the equal character for filtering by number field:
  'FILTER': {
        '=ID': [120,121],
   }

Full-text search can be used as well. To do that, use SEARCHABLE_CONTENT field with "*" prefix;

Example

var params = {
        'IBLOCK_TYPE_ID': 'lists_socnet',
        'IBLOCK_CODE': 'rest_1',
        'ELEMENT_CODE': 'element_1'
    };
    BX24.callMethod(
        'lists.element.get',
        params,
        function(result)
        {
            if(result.error())
                alert("Error: " + result.error());
            else
                console.log(result.data());
        }
    );
var params = {
        'IBLOCK_TYPE_ID': 'lists',
        'IBLOCK_ID': '41',
        'FILTER': {
            '>=DATE_CREATE': '27.03.2018 00:00:00',
            '<=DATE_CREATE': '27.03.2018 23:59:59',
        }
};

Example of disabling page by page navigation:

$result = CRest::call(
    'lists.element.get',
    [
        'IBLOCK_TYPE_ID' => 'lists',
        'IBLOCK_ID' => '42',
        'start' => -1
    ]
);


© «Bitrix24», 2001-2024