disk.rights.getTasks
Получить список доступных уровней доступа
Описание
Метод disk.rights.getTasks возвращает список доступных уровней доступа.
Используйте полученные идентификаторы уровней доступа для установки прав на файлы при их загрузке. Указывайте идентификаторы как значение параметра TASK_ID в методах disk.storage.uploadFile и disk.folder.uploadFile.
Примеры запроса
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/disk.rights.getTasks
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/disk.rights.getTasks
// 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 each AccessTask returned in result[]
type AccessTask = {
ID: string
NAME: string
TITLE: string
}
try {
// disk.rights.getTasks returns a single page (max 50 records). For the whole result set
// use a list helper: $b24.actions.v2.callList.make() returns every record as one
// array, $b24.actions.v2.fetchList.make() yields them in chunks (async generator).
// NOTE: the list helpers do not accept `order` (it is excluded from their params, so
// passing it is a TS error) — keep this call.make + `start` variant when sort matters.
const response = await $b24.actions.v2.call.make<AccessTask[]>({
method: 'disk.rights.getTasks',
params: {
start: 0,
},
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('Access levels:', result.length, 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 getDiskRightsTasks() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
// disk.rights.getTasks returns a single page (max 50 records). For the whole result set
// use a list helper: $b24.actions.v2.callList.make() returns every record as one
// array, $b24.actions.v2.fetchList.make() yields them in chunks (async generator).
// NOTE: the list helpers do not accept `order` (it is excluded from their params, so
// passing it is a TS error) — keep this call.make + `start` variant when sort matters.
const response = await $b24.actions.v2.call.make({
method: 'disk.rights.getTasks',
params: {
start: 0,
},
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('Access levels:', result.length, result)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', getDiskRightsTasks)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
try:
bitrix_response = client.disk.rights.get_tasks().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.rights.getTasks',
[]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
processData($result);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error: ' . $e->getMessage();
}
BX24.callMethod(
'disk.rights.getTasks',
{},
function (result) {
if (result.error()) {
console.error(result.error());
} else {
console.log(result.data());
}
}
);
require_once('crest.php');
$result = CRest::call(
'disk.rights.getTasks',
[]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "disk.rights.getTasks", nil)
if err != nil {
return fmt.Errorf("disk.rights.getTasks: %w", err)
}
var items []struct {
ID b24.ID `json:"ID"`
Name string `json:"NAME"`
Title string `json:"TITLE"`
}
if err := json.Unmarshal(res.Result, &items); err != nil {
return fmt.Errorf("разбор ответа: %w", err)
}
for _, it := range items {
fmt.Println(it.ID, it.Name)
}
Ответ
HTTP-статус: 200
{
"result": [
{
"ID": "79",
"NAME": "disk_access_full",
"TITLE": "Полный доступ"
},
{
"ID": "75",
"NAME": "disk_access_edit",
"TITLE": "Редактирование"
},
{
"ID": "71",
"NAME": "disk_access_read",
"TITLE": "Чтение"
}
],
"time": {
"start": 1766494790,
"finish": 1766494790.095506,
"duration": 0.09550595283508301,
"processing": 0,
"date_start": "2025-12-23T12:59:50+03:00",
"date_finish": "2025-12-23T12:59:50+03:00",
"operating_reset_at": 1766495390,
"operating": 0
}
}
Возвращаемые данные
result
array
Массив с доступными уровнями доступа
ID
integer
Идентификатор уровня доступа
NAME
string
Символьный код уровня доступа
TITLE
string
Название уровня доступа
time
time
Информация о времени выполнения запроса

