landing.block.getcontent
Получить контент блока
Описание
Метод landing.block.getcontent возвращает готовый HTML блока, его ресурсы, манифест и служебные свойства блока.
Параметры
scope
string
необязательный
Внутренний скоуп лендингов. Он не связан с REST-скоупом landing в названии метода.
Значение scope должно соответствовать типу сайта (подробное описание)
lid
integer
обязательный
Идентификатор страницы.
Идентификатор страницы можно получить методом landing.landing.getlist
block
integer
обязательный
Идентификатор блока.
Идентификатор блока можно получить методом landing.block.getlist
editMode
boolean
необязательный
Режим получения версии блока.
Возможные значения:
true — вернуть черновик блока со страницы,
false — вернуть опубликованную версию блока.
По умолчанию — false. При editMode=true метод автоматически включает возврат HTML для неактивного блока.
Если страница еще не публиковалась, вызов без editMode может не найти блок
params
object
необязательный
Дополнительные параметры (подробное описание)
Параметр params
wrapper_show
boolean
необязательный
Возвращать ли в result.content внешний контейнер блока <div class="block-wrapper">.
Возможные значения:
true — вернуть HTML вместе с внешним контейнером блока, который использует редактор страниц Битрикс24,
false — вернуть HTML блока без контейнера. По умолчанию — true
force_unactive
boolean
необязательный
Формировать HTML даже для неактивного блока.
Возможные значения:
true — вернуть HTML неактивного блока,
false — если блок неактивен, поле result.content вернется пустой строкой.
По умолчанию — false. При editMode=true этот режим включается автоматически
Примеры запроса
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"lid": 4858,
"block": 39556,
"editMode": true,
"params": {
"wrapper_show": false
}
}' \
"https://**put.your-domain-here**/rest/**user_id**/**webhook_code**/landing.block.getcontent.json"
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"lid": 4858,
"block": 39556,
"editMode": true,
"params": {
"wrapper_show": false
},
"auth": "**put_access_token_here**"
}' \
"https://**put.your-domain-here**/rest/landing.block.getcontent.json"
// 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 } from '@bitrix24/b24jssdk'
declare const $b24: B24Frame
// Shape of the payload returned in result (match the "response handling" section of the page)
type BlockContentResult = {
id: number
sections: string
active: boolean
access: string
anchor: string
php: boolean
designed: boolean
repoId: number | null
content: string
content_ext: string
css: string[]
js: string[]
assetStrings: string[]
lang: string[] | Record<string, string>
manifest: Record<string, unknown>
dynamicParams: unknown[]
}
try {
const response = await $b24.actions.v2.call.make<BlockContentResult>({
method: 'landing.block.getcontent',
params: {
lid: 4858,
block: 39556,
editMode: true,
params: {
wrapper_show: false,
},
},
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.id, result.content, result.active)
}
} 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 getBlockContent() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'landing.block.getcontent',
params: {
lid: 4858,
block: 39556,
editMode: true,
params: {
wrapper_show: false,
},
},
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.id, result.content, result.active)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', getBlockContent)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
try:
bitrix_response = client.landing.block.getcontent(
lid=4858,
block=39556,
edit_mode=True,
params={
"wrapper_show": False,
},
).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(
'landing.block.getcontent',
[
'lid' => 4858,
'block' => 39556,
'editMode' => true,
'params' => [
'wrapper_show' => false,
],
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . var_export($result, true);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error getting block content: ' . $e->getMessage();
}
BX24.callMethod(
'landing.block.getcontent',
{
lid: 4858,
block: 39556,
editMode: true,
params: {
wrapper_show: false
}
},
function(result)
{
if (result.error())
{
console.error(result.error());
}
else
{
console.info(result.data());
}
}
);
require_once('crest.php');
$result = CRest::call(
'landing.block.getcontent',
[
'lid' => 4858,
'block' => 39556,
'editMode' => true,
'params' => [
'wrapper_show' => false,
],
]
);
if (isset($result['error']))
{
echo 'Ошибка: ' . $result['error_description'];
}
else
{
echo '<pre>';
print_r($result['result']);
echo '</pre>';
}
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "landing.block.getcontent", b24.Params{
"lid": 4858,
"block": 39556,
"editMode": true,
"params": b24.Params{
"wrapper_show": false,
},
})
if err != nil {
return fmt.Errorf("landing.block.getcontent: %w", err)
}
var item struct {
ID b24.ID `json:"id"`
Sections string `json:"sections"`
Active bool `json:"active"`
Access string `json:"access"`
Anchor string `json:"anchor"`
Php bool `json:"php"`
}
if err := json.Unmarshal(res.Result, &item); err != nil {
return fmt.Errorf("разбор ответа: %w", err)
}
fmt.Println(item.ID, item.Sections)
Ответ
HTTP-статус: 200
{
"result": {
"id": 28853,
"sections": "tiles,news",
"active": true,
"access": "X",
"anchor": "b28853",
"php": false,
"designed": false,
"repoId": null,
"content": "<div id=\"block28853\" data-id=\"28853\" class=\"block-wrapper block-18-2-two-cols-fix-img-text-button-with-cards\"><section class=\"landing-block g-pt-30 g-pb-30 g-bg-transparent\">...</section></div>",
"content_ext": "",
"css": [],
"js": [
"/bitrix/js/pull/protobuf/protobuf.js?1592315491274055",
"/bitrix/js/pull/protobuf/model.min.js?159231549114190",
"/bitrix/js/main/core/core_promise.min.js?17647596972494",
"/bitrix/js/rest/client/rest.client.min.js?16015491189240",
"/bitrix/js/pull/client/pull.client.min.js?174471771449849"
],
"assetStrings": [],
"lang": [],
"manifest": {
"block": {
"name": "Список страниц с маленькой картинкой слева",
"section": [
"tiles",
"news"
]
},
"cards": {
".landing-block-card": {
"name": "Карточка",
"label": [
".landing-block-node-img",
".landing-block-node-title"
]
}
}
},
"dynamicParams": []
},
"time": {
"start": 1774520845,
"finish": 1774520845.380018,
"duration": 0.3800179958343506,
"processing": 0,
"date_start": "2026-03-26T13:27:25+03:00",
"date_finish": "2026-03-26T13:27:25+03:00",
"operating_reset_at": 1774521445,
"operating": 0
}
}
Возвращаемые данные
result
object
Данные блока (подробное описание)
time
time
Информация о времени выполнения запроса
Обработка ошибок
HTTP-статус: 400
{
"error": "BLOCK_NOT_FOUND",
"error_description": "Блок не найден"
}
| Код | Описание | Значение |
|---|---|---|
MISSING_PARAMS |
Не передан обязательный верхнеуровневый параметр lid или block |
|
LANDING_NOT_EXIST |
Страница с идентификатором lid не найдена или недоступна текущему пользователю |
|
ACCESS_DENIED |
Нет доступа к разделу «Сайты и магазины» | |
BLOCK_NOT_FOUND |
Блок с идентификатором block не найден в выбранной версии страницы |

