biconnector.source.get
Получить источник по id
Описание
Метод biconnector.source.get возвращает информацию об источнике по идентификатору.
Параметры
id
integer
обязательный
Идентификатор источника, можно получить методами biconnector.source.list и biconnector.source.add
Примеры запроса
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":6}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/biconnector.source.get
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":6,"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/biconnector.source.get
// This snippet is an ES module: top-level await requires type="module" or a bundler.
// $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
import { Text } from '@bitrix24/b24jssdk'
import type { B24Frame, ISODate } from '@bitrix24/b24jssdk'
declare const $b24: B24Frame
// Shape of the payload returned in result (match the "response handling" section of the page)
type SourceGetResult = {
item: {
connection: {
id: number
type: string
code: string
title: string
description: string
active: boolean
dateCreate: ISODate | null
dateUpdate: ISODate | null
createdById: number
updatedById: number
}
connectorId: number
settings: Array<{
code: string
name: string
type: string
value: string
id: number
}>
}
}
try {
const response = await $b24.actions.v2.call.make<SourceGetResult>({
method: 'biconnector.source.get',
params: {
id: 6,
},
requestId: Text.getUuidRfc4122()
})
// The payload is available only on a successful response
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
} else {
const result = response.getData()!.result
console.info(result.item.connection.id, result.item.connection.title, result.item.settings)
}
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
<!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
<script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
<script>
async function getSource() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'biconnector.source.get',
params: {
id: 6,
},
requestId: B24Js.Text.getUuidRfc4122()
})
// The payload is available only on a successful response
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
return
}
const result = response.getData().result
console.info(result.item.connection.id, result.item.connection.title, result.item.settings)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', getSource)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
try:
bitrix_response = client.biconnector.source.get(
bitrix_id=6,
).response
result = bitrix_response.result
print(result)
except BitrixAPIError as error:
print(
"Ошибка Bitrix API",
f"error: {error.error}",
f"error_description: {error.error_description}",
sep="\n",
)
except BitrixSDKException as error:
print(f"Ошибка Bitrix SDK: {error.message}")
except Exception as error:
print(f"Непредвиденная ошибка: {error}")
try {
$response = $b24Service
->core
->call(
'biconnector.source.get',
[
'id' => 6,
]
);
$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 getting source: ' . $e->getMessage();
}
BX24.callMethod(
'biconnector.source.get',
{
id: 6,
},
(result) => {
result.error() ? console.error(result.error()) : console.info(result.data());
}
);
require_once('crest.php');
$result = CRest::call(
'biconnector.source.get',
[
'id' => 6
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "biconnector.source.get", b24.Params{
"id": 6,
}, b24.WithIdempotent())
if err != nil {
return fmt.Errorf("biconnector.source.get: %w", err)
}
// Метод заворачивает ответ в объект с ключом "item".
raw, ok := b24.Unwrap(res.Result, "item")
if !ok {
return fmt.Errorf("в ответе нет ключа item")
}
var item struct {
ConnectorID b24.ID `json:"connectorId"`
}
if err := json.Unmarshal(raw, &item); err != nil {
return fmt.Errorf("разбор ответа: %w", err)
}
fmt.Println(item.ConnectorID)
Ответ
HTTP-статус: 200
{
"result": {
"item": {
"connection": {
"id": 6,
"type": "rest",
"code": "rest_1",
"title": "Rest source SQL",
"description": "Подключение для работы с mySql",
"active": true,
"dateCreate": "2025-03-20 14:50:06",
"dateUpdate": "2025-03-20 14:50:06",
"createdById": 1,
"updatedById": 1
},
"connectorId": 1,
"settings": [
{
"code": "token",
"name": "Токен",
"type": "STRING",
"value": "beliberda",
"id": 8
}
]
}
},
"time": {
"start": 1742929480.368097,
"finish": 1742929480.449558,
"duration": 0.08146095275878906,
"processing": 0.006555080413818359,
"date_start": "2025-03-25T19:04:40+00:00",
"date_finish": "2025-03-25T19:04:40+00:00"
}
}
Возвращаемые данные
result
object
Корневой элемент ответа. Содержит информацию о полях источника. Описание полей в статье Источники: обзор методов
time
time
Информация о времени выполнения запроса
Обработка ошибок
HTTP-статус: 200
{
"error": "VALIDATION_ID_NOT_PROVIDED",
"error_description": "ID is missing."
}
| Код | Описание | Значение |
|---|---|---|
VALIDATION_ID_NOT_PROVIDED |
ID is missing. | Идентификатор не указан |
VALIDATION_INVALID_ID_FORMAT |
ID has to be a positive integer. | Неверный формат ID |
SOURCE_NOT_FOUND |
Source was not found. | Источник не найден |

