Get the list of sources biconnector.source.list

Scope: biconnector

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

The method biconnector.source.list returns a list of sources based on a filter. It is an implementation of the list method for sources.

Method Parameters

Name
type

Description

select
string[]

List of fields that must be filled in the sources in the selection. By default, all fields are taken

filter
object

Filter for selecting sources. Example format:

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

You can add a prefix to the keys field_n to clarify the filter's 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 =%)
  • = — equal, exact match (used by default)
  • != — not equal
  • ! — not equal

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

The filter does not support the settings field; it will be ignored

order
object

Sorting parameters. Example format:

{
            field_1: value_1,
            field_2: value_2,
            ...,
            field_n: value_n,
        }
        
  • field_n — the name of the field by which the sources will be sorted
  • value_n — a string type value, equal to:
    • ASC — ascending sort
    • DESC — descending sort

page
integer

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

Code Examples

How to Use Examples in Documentation

Get the list of sources where:

  • the name starts with Sql
  • the description is not empty
  • the connector ID is equal to 2 or 4

Display only the necessary fields:

  • ID id
  • Title title
  • Active active
  • Creation date dateCreate
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"select":["id","title","active","dateCreate"],"filter":{"%=title":"Sql%","!description":"","@connectorId":[2,4]},"order":{"dateCreate":"DESC"}}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/biconnector.source.list
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"select":["id","title","active","dateCreate"],"filter":{"%=title":"Sql%","!description":"","@connectorId":[2,4]},"order":{"dateCreate":"DESC"},"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/biconnector.source.list
        
// callListMethod: Retrieves all data at once. Use only for small selections (< 1000 items) due to high memory usage.
        
        const selectFields = [
            "id",
            "title",
            "active",
            "dateCreate"
        ];
        
        try {
            const response = await $b24.callListMethod(
                'biconnector.source.list',
                {
                    select: selectFields,
                    filter: {
                        '%=title': "Sql%",
                        '!description': "",
                        "@connectorId": [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.
        
        const selectFields = [
            "id",
            "title",
            "active",
            "dateCreate"
        ];
        
        try {
            const generator = $b24.fetchListMethod('biconnector.source.list', {
                select: selectFields,
                filter: {
                    '%=title': "Sql%",
                    '!description': "",
                    "@connectorId": [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.
        
        const selectFields = [
            "id",
            "title",
            "active",
            "dateCreate"
        ];
        
        try {
            const response = await $b24.callMethod('biconnector.source.list', {
                select: selectFields,
                filter: {
                    '%=title': "Sql%",
                    '!description': "",
                    "@connectorId": [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.source.list',
                    [
                        'select' => [
                            "id",
                            "title",
                            "active",
                            "dateCreate"
                        ],
                        'filter' => [
                            '%=title'      => "Sql%",
                            '!description' => "",
                            "@connectorId" => [2, 4]
                        ],
                        'order'  => [
                            'dateCreate' => "DESC"
                        ]
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            if ($result->error()) {
                echo 'Error: ' . $result->error();
            } else {
                echo 'Data: ' . print_r($result->data(), true);
            }
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error fetching source list: ' . $e->getMessage();
        }
        
BX24.callMethod(
            'biconnector.source.list',
            {
                select: [
                    "id",
                    "title",
                    "active",
                    "dateCreate"
                ],
                filter: {
                    '%=title': "Sql%",
                    '!description': "",
                    "@connectorId": [2, 4]
                },
                order: {
                    dateCreate: "DESC"
                }
            },
            (result) => {
                result.error()
                    ? console.error(result.error())
                    : console.info(result.data());
            }
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'biconnector.source.list',
            [
                'select' => [
                    "id",
                    "title",
                    "active",
                    "dateCreate"
                ],
                'filter' => [
                    '%=title' => "Sql%",
                    '!description' => "",
                    '@connectorId' => [2, 4]
                ],
                'order' => [
                    'dateCreate' => "DESC"
                ]
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        

Response Handling

HTTP status: 200

{
            "result": [
                {
                    "id": "11",
                    "title": "Sql_host",
                    "active": true,
                    "dateCreate": "2025-03-24 07:25:59"
                },
                {
                    "id": "10",
                    "title": "Sql_partner",
                    "active": false,
                    "dateCreate": "2025-03-21 12:22:32"
                }
            ],
            "time": {
                "start": 1742804947.923552,
                "finish": 1742804947.995446,
                "duration": 0.07189393043518066,
                "processing": 0.0017020702362060547,
                "date_start": "2025-03-24T08:29:07+00:00",
                "date_finish": "2025-03-24T08:29:07+00:00"
            }
        }
        

Returned Data

result
object

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

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