Get the list of datasets biconnector.dataset.list

Scope: biconnector

Who can execute the method: a user with access to the "Analyst Workspace" section

The method biconnector.dataset.list returns a list of datasets based on a filter. It is an implementation of the listing method for datasets.

Method Parameters

Name
type

Description

select
string[]

A list of fields that must be populated in the datasets in the selection. By default, all fields are taken.
The fields parameter is not supported and will be ignored.

filter
object

Filter for selecting datasets. Example format:

{
            "field_1": "value_1",
            "field_2": "value_2"
        }
        

You can add a prefix to the keys field_n to specify the filter operation.
Possible prefix values:

  • >= — greater than or equal to
  • > — greater than
  • <= — less than or equal to
  • < — less than
  • @ — IN, an array is passed as the value
  • !@ — NOT IN, an array is passed as the value
  • % — LIKE, substring search. The % symbol in the filter value does not need to be passed. The search looks for a substring in any position of the string.
  • =% — LIKE, substring search. The % symbol needs to be passed in the value. Examples:
    • "mol%" — searches for values starting with "mol"
    • "%mol" — searches for values ending with "mol"
    • "%mol%" — searches for values where "mol" can be in any position
  • %= — LIKE (similar to =%)
  • = — equals, exact match (used by default)
  • != — not equal
  • ! — not equal

The list of available fields for filtering can be found using the method biconnector.dataset.fields.

The filter does not support the fields parameter and it will be ignored.

order
object

Sorting parameters. Example format:

{
            field_1: value_1,
            field_2: value_2,
            ...,
            field_n: value_n,
        }
        

where:

  • field_n — the name of the field by which the dataset selection will be sorted
  • value_n — a string value equal to:
    • ASC — ascending sort
    • DESC — descending sort

page
integer

Controls pagination. The page size of results is 50 records. To navigate through the results, pass the page number.

Code Examples

How to Use Examples in Documentation

Get the list of sources where:

  • the name starts with Sales
  • the description is not empty
  • the source ID equals 2 or 4

For clarity, select only the necessary fields:

  • ID id
  • Name name
  • Description description
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{
            "select": ["id", "name", "description"],
            "filter": {
                "%=name": "Sales%",
                "!description": "",
                "@sourceId": [2, 4]
            },
            "order": {
                "dateCreate": "DESC"
            }
        }' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/biconnector.dataset.list
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{
            "select": ["id", "name", "description"],
            "filter": {
                "%=name": "Sales%",
                "!description": "",
                "@sourceId": [2, 4]
            },
            "order": {
                "dateCreate": "DESC"
            },
            "auth": "**put_access_token_here**"
        }' \
        https://**put_your_bitrix24_address**/rest/biconnector.dataset.list
        
// callListMethod: Retrieves all data at once. Use only for small selections (< 1000 items) due to high memory usage.
        
        try {
          const response = await $b24.callListMethod(
            'biconnector.dataset.list',
            {
              select: ["id", "name", "description"],
              filter: {
                '%=name': "Sales%",
                '!description': "",
                "@sourceId": [2, 4]
              },
              order: {
                dateCreate: "DESC"
              }
            },
            (progress) => { console.log('Progress:', progress) }
          );
          const items = response.getData() || [];
          for (const entity of items) { console.log('Entity:', entity); }
        } catch (error) {
          console.error('Request failed', error);
        }
        
        // fetchListMethod: Retrieves data in parts using an iterator. Use it for large data volumes to optimize memory usage.
        
        try {
          const generator = $b24.fetchListMethod('biconnector.dataset.list', {
            select: ["id", "name", "description"],
            filter: {
              '%=name': "Sales%",
              '!description': "",
              "@sourceId": [2, 4]
            },
            order: {
              dateCreate: "DESC"
            }
          }, 'ID');
          for await (const page of generator) {
            for (const entity of page) { console.log('Entity:', entity); }
          }
        } catch (error) {
          console.error('Request failed', error);
        }
        
        // callMethod: Manually controls pagination through the start parameter. Use it for precise control of request batches. For large datasets, it is less efficient than fetchListMethod.
        
        try {
          const response = await $b24.callMethod('biconnector.dataset.list', {
            select: ["id", "name", "description"],
            filter: {
              '%=name': "Sales%",
              '!description': "",
              "@sourceId": [2, 4]
            },
            order: {
              dateCreate: "DESC"
            }
          }, 0);
          const result = response.getData().result || [];
          for (const entity of result) { console.log('Entity:', entity); }
        } catch (error) {
          console.error('Request failed', error);
        }
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'biconnector.dataset.list',
                    [
                        'select' => ["id", "name", "description"],
                        'filter' => [
                            '%=name'      => "Sales%",
                            '!description' => "",
                            "@sourceId"   => [2, 4]
                        ],
                        'order'  => [
                            'dateCreate' => "DESC"
                        ]
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            if ($response->getError()) {
                error_log($response->getError());
                echo 'Error: ' . $response->getError();
            } else {
                echo 'Success: ' . print_r($result, true);
                // Your data processing logic
                processData($result);
            }
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error calling biconnector.dataset.list: ' . $e->getMessage();
        }
        
BX24.callMethod(
            'biconnector.dataset.list',
            {
                select: ["id", "name", "description"],
                filter: {
                    '%=name': "Sales%",
                    '!description': "",
                    "@sourceId": [2, 4]
                },
                order: {
                    dateCreate: "DESC"
                }
            },
            (result) => {
                result.error()
                    ? console.error(result.error())
                    : console.info(result.data());
            }
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'biconnector.dataset.list',
            [
                'select' => ["id", "name", "description"],
                'filter' => ['%=name' => "Sales%", '!description' => "", '@sourceId' => [2, 4]],
                'order' => ['dateCreate' => "DESC"]
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        

Response Handling

HTTP status: 200

{
            "result": [
                {
                    "id": "9",
                    "name": "sales_data_main",
                    "description": "Monthly sales report"
                },
                {
                    "id": "6",
                    "name": "sales_data_first_branch",
                    "description": "Monthly sales report for first branch"
                },
                {
                    "id": "5",
                    "name": "sales_data_second_branch",
                    "description": "Monthly sales report for second branch"
                }
            ],
            "time": {
                "start": 1743061675.963969,
                "finish": 1743061676.064591,
                "duration": 0.10062193870544434,
                "processing": 0.011152029037475586,
                "date_start": "2025-03-27T07:47:55+00:00",
                "date_finish": "2025-03-27T07:47:56+00:00"
            }
        }
        

Returned Data

result
object

The root element of the response. Contains an array of objects with information about the fields of the datasets.

It should be noted that the structure of the fields may change due to the select parameter.

time
time

Information about the execution time of the request.

Error Handling

HTTP status: 200

{
            "error": "VALIDATION_SELECT_TYPE",
            "error_description": "Parameter \"select\" must be array."
        }
        

Name
type

Description

error
string

String error code. It may consist of digits, Latin letters, and underscores

error_description
error_description

Textual description of the error. The description is not intended to be shown to the end user in its raw form

Possible Error Codes

Code

Description

Value

VALIDATION_SELECT_TYPE

Parameter "select" must be array.

The select parameter is not an object.

VALIDATION_FILTER_TYPE

Parameter "filter" must be array.

The filter parameter is not an object.

VALIDATION_ORDER_TYPE

Parameter "order" must be array.

The order parameter is not an object.

VALIDATION_FIELD_NOT_ALLOWED_IN_SELECT

Field "#TITLE#" is not allowed in the "select".

These fields are not allowed in the selection.

VALIDATION_FIELD_NOT_ALLOWED_IN_FILTER

Field "#TITLE#" is not allowed in the "filter".

These fields are not allowed in the filter.

VALIDATION_FIELD_NOT_ALLOWED_IN_ORDER

Field "#TITLE#" is not allowed in the "order".

These fields are not allowed for sorting.

Statuses and System Error Codes

HTTP Status: 20x, 40x, 50x

The errors described below may occur when calling any method.

Status

Code
Error Message

Description

500

INTERNAL_SERVER_ERROR
Internal server error

An internal server error has occurred, please contact the server administrator or Bitrix24 technical support

500

ERROR_UNEXPECTED_ANSWER
Server returned an unexpected response

An internal server error has occurred, please contact the server administrator or Bitrix24 technical support

503

QUERY_LIMIT_EXCEEDED
Too many requests

The request intensity limit has been exceeded

405

ERROR_BATCH_METHOD_NOT_ALLOWED
Method is not allowed for batch usage

The current method is not allowed to be called using batch

400

ERROR_BATCH_LENGTH_EXCEEDED
Max batch length exceeded

The maximum length of parameters passed to the batch method has been exceeded

401

NO_AUTH_FOUND
Wrong authorization data

Invalid access token or webhook code

400

INVALID_REQUEST
Https required

The methods must be called using the HTTPS protocol

503

OVERLOAD_LIMIT
REST API is blocked due to overload

The REST API is blocked due to overload. This is a manual individual block, to remove it you need to contact Bitrix24 technical support

403

ACCESS_DENIED
REST API is available only on commercial plans

The REST API is available only on commercial plans

403

INVALID_CREDENTIALS
Invalid request credentials

The user whose access token or webhook was used to call the method lacks permissions

404

ERROR_MANIFEST_IS_NOT_AVAILABLE
Manifest is not available

The manifest is not available

403

insufficient_scope
The request requires higher privileges than provided by the webhook token

The request requires higher privileges than those provided by the webhook token

401

expired_token
The access token provided has expired

The provided access token has expired

403

user_access_error
The user does not have access to the application

The user does not have access to the application. This means that the application is installed, but the account administrator has allowed access to this application only for specific users

500

PORTAL_DELETED
Portal was deleted

The public part of the site is closed. To open the public part of the site on an on-premise installation, disable the option "Temporary closure of the public part of the site". Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site

Continue Learning