biconnector.connector.get
Получить коннектор по id
Описание
Метод biconnector.connector.get возвращает информацию о коннекторе по идентификатору.
Параметры
id
integer
обязательный
Идентификатор коннектора, можно получить методами biconnector.connector.list и biconnector.connector.add
Примеры запроса
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"id": 4
}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/biconnector.connector.get
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"id": 4,
"auth": "**put_access_token_here**"
}' \
https://**put_your_bitrix24_address**/rest/biconnector.connector.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 ConnectorGetResult = {
item: {
id: number
title: string
dateCreate: ISODate | null
logo: string
description: string
sort: number
urlCheck: string
settings: Array<{
name: string
code: string
type: string
}>
urlData: string
urlTableList: string
urlTableDescription: string
}
}
try {
const response = await $b24.actions.v2.call.make<ConnectorGetResult>({
method: 'biconnector.connector.get',
params: {
id: 4,
},
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.id, result.item.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 getConnector() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'biconnector.connector.get',
params: {
id: 4,
},
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.id, result.item.title, result.item.settings)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', getConnector)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
try:
bitrix_response = client.biconnector.connector.get(
bitrix_id=4,
).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.connector.get',
[
'id' => 4,
]
);
$result = $response
->getResponseData()
->getResult();
if ($result->error()) {
echo 'Error: ' . $result->error();
} else {
echo 'Info: ' . print_r($result->data(), true);
}
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error calling biconnector.connector.get: ' . $e->getMessage();
}
BX24.callMethod(
'biconnector.connector.get',
{
id: 4,
},
(result) => {
result.error() ? console.error(result.error()) : console.info(result.data());
}
);
require_once('crest.php');
$result = CRest::call(
'biconnector.connector.get',
[
'id' => 4
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "biconnector.connector.get", b24.Params{
"id": 4,
}, b24.WithIdempotent())
if err != nil {
return fmt.Errorf("biconnector.connector.get: %w", err)
}
// Метод заворачивает ответ в объект с ключом "item".
raw, ok := b24.Unwrap(res.Result, "item")
if !ok {
return fmt.Errorf("в ответе нет ключа item")
}
var item struct {
ID b24.ID `json:"id"`
Title string `json:"title"`
DateCreate string `json:"dateCreate"`
Logo string `json:"logo"`
Description string `json:"description"`
Sort int `json:"sort"`
}
if err := json.Unmarshal(raw, &item); err != nil {
return fmt.Errorf("разбор ответа: %w", err)
}
fmt.Println(item.ID, item.Title)
Ответ
HTTP-статус: 200
{
"result": {
"item": {
"id": 5,
"title": "SUPER REST CONNECTOR",
"dateCreate": "2025-03-24 07:25:59",
"logo": "https://masterpiecer-images.s3.yandex.net/5fd531dca6427c7:upscaled",
"description": "Connector with token",
"sort": 100,
"urlCheck": "http://app.domain/check",
"settings": [
{
"name": "Логин",
"code": "login",
"type": "STRING"
},
{
"name": "Пароль",
"code": "password",
"type": "STRING"
}
],
"urlData": "http://app.domain/data",
"urlTableList": "http://app.domain/table_list",
"urlTableDescription": "http://app.domain/table_description"
}
},
"time": {
"start": 1725365418.056843,
"finish": 1725365419.671506,
"duration": 1.6146628856658936,
"processing": 1.3475170135498047,
"date_start": "2024-09-03T14:10:18+02:00",
"date_finish": "2024-09-03T14:10:19+02: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 |
CONNECTOR_NOT_FOUND |
Connector was not found. | Коннектор не найден |

