landing.landing.getpreview
Получить URL превью страницы
Описание
Метод landing.landing.getpreview возвращает URL или относительный путь до изображения превью страницы.
Параметры
scope
string
необязательный
Внутренний скоуп лендингов. Он не связан с REST-скоупом landing в названии метода.
Значение scope должно соответствовать типу сайта (подробное описание)
lid
integer
обязательный
Идентификатор страницы.
Идентификатор страницы можно получить с помощью метода landing.landing.getList или из результата метода landing.landing.add
Примеры запроса
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"lid": 351
}' \
"https://**put.your-domain-here**/rest/**user_id**/**webhook_code**/landing.landing.getpreview.json"
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"lid": 351,
"auth": "**put_access_token_here**"
}' \
"https://**put.your-domain-here**/rest/landing.landing.getpreview.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
try {
const response = await $b24.actions.v2.call.make<string>({
method: 'landing.landing.getpreview',
params: {
lid: 351,
},
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('Preview URL:', result)
}
} 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 getLandingPreview() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'landing.landing.getpreview',
params: {
lid: 351,
},
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('Preview URL:', result)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', getLandingPreview)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
try:
bitrix_response = client.landing.landing.getpreview(
lid=351,
).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.landing.getpreview',
[
'lid' => 351,
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . $result;
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error getting landing preview: ' . $e->getMessage();
}
BX24.callMethod(
'landing.landing.getpreview',
{
lid: 351
},
function(result)
{
if (result.error())
{
console.error(result.error());
}
else
{
console.info(result.data());
}
}
);
require_once('crest.php');
$result = CRest::call(
'landing.landing.getpreview',
[
'lid' => 351,
]
);
if (isset($result['error']))
{
echo 'Ошибка: ' . $result['error_description'];
}
else
{
echo $result['result'];
}
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "landing.landing.getpreview", b24.Params{
"lid": 351,
})
if err != nil {
return fmt.Errorf("landing.landing.getpreview: %w", err)
}
var value string
if err := json.Unmarshal(res.Result, &value); err != nil {
return fmt.Errorf("разбор ответа: %w", err)
}
fmt.Println("результат:", value)
Ответ
HTTP-статус: 200
{
"result": "https://example.bitrix24.site/preview.jpg",
"time": {
"start": 1773717121,
"finish": 1773717121.107574,
"duration": 0.1075739860534668,
"processing": 0,
"date_start": "2026-03-17T06:12:01+03:00",
"date_finish": "2026-03-17T06:12:01+03:00",
"operating_reset_at": 1773717721,
"operating": 0
}
}
Возвращаемые данные
result
string
URL или относительный путь до изображения превью страницы.
Метод возвращает URL превью страницы, путь к изображению или "/bitrix/images/landing/nopreview.jpg", если превью не задано
time
time
Информация о времени выполнения запроса
Обработка ошибок
HTTP-статус: 400
{
"error": "LANDING_NOT_EXIST",
"error_description": "Лендинг не найден"
}
| Код | Описание | Значение |
|---|---|---|
MISSING_PARAMS |
Недостаточно параметров вызова, пропущены: lid |
|
LANDING_NOT_EXIST |
Лендинг не найден. Метод возвращает этот код, если страница не найдена или у текущего пользователя нет прав на ее просмотр |

