disk.folder.restore
Восстановить папку из корзины
Описание
Метод disk.folder.restore восстанавливает папку из корзины.
Параметры
id
integer
обязательный
Идентификатор папки, находящейся в корзине.
Папки в корзине не доступны для запроса через стандартные методы. Чтобы получить идентификатор папки для восстановления, сохраните его сразу после вызова метода disk.folder.markDeleted
Примеры запроса
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":8996}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/disk.folder.restore
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":8996,"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/disk.folder.restore
// 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 DiskFolderRestoreResult = {
ID: string
NAME: string
CODE: string | null
STORAGE_ID: string
TYPE: string
REAL_OBJECT_ID: string
PARENT_ID: string
DELETED_TYPE: number
CREATE_TIME: ISODate
UPDATE_TIME: ISODate
DELETE_TIME: ISODate | null
CREATED_BY: string
UPDATED_BY: string
DELETED_BY: string
DETAIL_URL: string
}
try {
const response = await $b24.actions.v2.call.make<DiskFolderRestoreResult>({
method: 'disk.folder.restore',
params: {
id: 8996,
},
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('Restored folder:', result.ID, result.NAME, result.DETAIL_URL)
}
} 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 restoreFolder() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'disk.folder.restore',
params: {
id: 8996,
},
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('Restored folder:', result.ID, result.NAME, result.DETAIL_URL)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', restoreFolder)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
try:
bitrix_response = client.disk.folder.restore(
bitrix_id=8996,
).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(
'disk.folder.restore',
[
'id' => 8996
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
processData($result);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error restoring folder: ' . $e->getMessage();
}
BX24.callMethod(
"disk.folder.restore",
{
id: 8996
},
function (result)
{
if (result.error())
console.error(result.error());
else
console.dir(result.data());
}
);
require_once('crest.php');
$result = CRest::call(
'disk.folder.restore',
[
'id' => 8996
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "disk.folder.restore", b24.Params{
"id": 8996,
})
if err != nil {
return fmt.Errorf("disk.folder.restore: %w", err)
}
var item struct {
ID b24.ID `json:"ID"`
Name string `json:"NAME"`
StorageID b24.ID `json:"STORAGE_ID"`
Type string `json:"TYPE"`
RealObjectID b24.ID `json:"REAL_OBJECT_ID"`
ParentID b24.ID `json:"PARENT_ID"`
}
if err := json.Unmarshal(res.Result, &item); err != nil {
return fmt.Errorf("разбор ответа: %w", err)
}
fmt.Println(item.ID, item.Name)
Ответ
HTTP-статус: 200
{
"result": {
"ID": "8996",
"NAME": "Папка",
"CODE": null,
"STORAGE_ID": "1357",
"TYPE": "folder",
"REAL_OBJECT_ID": "8996",
"PARENT_ID": "8907",
"DELETED_TYPE": 0,
"CREATE_TIME": "2026-01-21T13:53:51+03:00",
"UPDATE_TIME": "2026-01-22T17:15:24+03:00",
"DELETE_TIME": "2026-01-21T13:56:54+03:00",
"CREATED_BY": "1269",
"UPDATED_BY": "1269",
"DELETED_BY": "1269",
"DETAIL_URL": "https://test.bitrix24.ru/company/personal/user/1269/disk/path/Папка/Папка"
},
"time": {
"start": 1769109324,
"finish": 1769109325.004873,
"duration": 1.0048730373382568,
"processing": 1,
"date_start": "2026-01-22T17:15:24+03:00",
"date_finish": "2026-01-22T17:15:25+03:00",
"operating_reset_at": 1769109924,
"operating": 0
}
}
Возвращаемые данные
result
array
Массив с данными о папке
ID
integer
Идентификатор папки
NAME
string
Имя папки
CODE
string
Символьный код папки
STORAGE_ID
integer
Идентификатор хранилища, в котором находится папка
TYPE
enum
Тип объекта
REAL_OBJECT_ID
integer
Идентификатор объекта
PARENT_ID
integer
Идентификатор родительской папки
DELETED_TYPE
enum
Статус удаления объекта. Возможные значения:
- 0 — не удален
- 3 — в корзине
- 4 — удален вместе с родительской папкой
CREATE_TIME
datetime
Дата и время создания папки
UPDATE_TIME
datetime
Дата и время последнего обновления папки
DELETE_TIME
datetime
Дата и время переноса папки в корзину
CREATED_BY
integer
Идентификатор пользователя, создавшего папку
UPDATED_BY
integer
Идентификатор пользователя, внесшего последнее изменение
DELETED_BY
integer
Идентификатор пользователя, удалившего папку
DETAIL_URL
string
Ссылка для открытия папки в интерфейсе
time
time
Информация о времени выполнения запроса
Обработка ошибок
HTTP-статус: 400
{
"error":"ERROR_ARGUMENT",
"error_description":"Invalid value of parameter {Parameter #1}"
}
| Код | Описание | Значение |
|---|---|---|
ERROR_ARGUMENT |
Invalid value of parameter {Parameter #1} | Не указан обязательный параметр id |
ERROR_NOT_FOUND |
Could not find entity with id X |
Папка с указанным id не найдена |
ACCESS_DENIED |
Access denied | Недостаточно прав для восстановления папки |

