tasks.task.get
Получить задачу по идентификатору v 3.0
Описание
Метод относится к REST 3.0. Особенности вызова и формат ответа новой версии API описаны в обзоре REST 3.0.
Метод tasks.task.get возвращает информацию о задаче по идентификатору.
Доступ к данным зависит от прав:
- администратор видит все задачи,
- руководитель — задачи своих сотрудников,
- остальные видят только доступные им задачи.
Параметры
id
integer
обязательный
Идентификатор задачи.
Идентификатор задачи можно получить при создании новой задачи или старым методом получения списка задач
select
array
необязательный
Массив полей, которые вернет метод. Если select не задан, приходит базовый набор полей задачи без связанных объектов.
Для связанных объектов используйте вложенный путь через точку, например ["responsible.name","responsible.email"] - в ответе появится объект responsible с запрошенными полями. Перечень полей со связанными объектами
Примеры запроса
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":8017,"select":["responsible.name","responsible.email"]}' \
https://**put_your_bitrix24_address**/rest/api/**put_your_user_id_here**/**put_your_webhook_here**/tasks.task.get
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":8017,"select":["responsible.name","responsible.email"],"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/api/tasks.task.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 TaskGetResult = {
item: {
id: number
title: string
description: string
responsible?: {
name: string
email: string
}
deadline: ISODate | null
status: string
priority: string
statusChanged: ISODate | null
changed: ISODate | null
}
}
try {
const response = await $b24.actions.v3.call.make<TaskGetResult>({
method: 'tasks.task.get',
params: {
id: 8017,
select: [
'responsible.name',
'responsible.email',
],
},
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('Task:', result.item.id, result.item.title, result.item.responsible)
}
} 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 getTask() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v3.call.make({
method: 'tasks.task.get',
params: {
id: 8017,
select: [
'responsible.name',
'responsible.email',
],
},
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('Task:', result.item.id, result.item.title, result.item.responsible)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', getTask)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
select = [
"responsible.name",
"responsible.email",
]
try:
bitrix_response = client.tasks.task.get(
bitrix_id=8017,
select=select,
).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(
'tasks.task.get',
[
'id' => 8017,
'select' => [
'responsible.name',
'responsible.email'
]
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error fetching task: ' . $e->getMessage();
}
BX24.callMethod(
'tasks.task.get',
{
id: 8017,
select: [
'responsible.name',
'responsible.email'
]
},
function(result){
console.info(result.data());
console.log(result);
}
);
require_once('crest.php');
$result = CRest::call(
'tasks.task.get',
[
'id' => 8017,
'select' => [
'responsible.name',
'responsible.email'
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "tasks.task.get", b24.Params{
"id": 8017,
"select": []string{"responsible.name", "responsible.email"},
}, b24.WithIdempotent())
if err != nil {
return fmt.Errorf("tasks.task.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"`
Description string `json:"description"`
Deadline string `json:"deadline"`
NeedsControl bool `json:"needsControl"`
Priority string `json:"priority"`
}
if err := json.Unmarshal(raw, &item); err != nil {
return fmt.Errorf("разбор ответа: %w", err)
}
fmt.Println(item.ID, item.Title)
Ответ
HTTP-статус: 200
{
"result": {
"item": {
"id": 3835,
"title": "название",
"description": "описание",
"responsible": {
"name": "Саша",
"email": "mail@bitrix.ru"
},
"deadline": "2025-12-25T23:00:00+03:00",
"needsControl": false,
"startPlan": null,
"endPlan": null,
"fileIds": null,
"checklist": [
153,
165
],
"epicId": null,
"storyPoints": null,
"priority": "average",
"status": "pending",
"statusChanged": "2025-11-24T06:00:00+03:00",
"parentId": null,
"containsChecklist": true,
"containsSubTasks": false,
"containsRelatedTasks": false,
"containsGanttLinks": false,
"containsPlacements": true,
"containsResults": false,
"numberOfReminders": 0,
"chatId": 2537,
"plannedDuration": 0,
"actualDuration": 0,
"durationType": "days",
"started": null,
"estimatedTime": 0,
"replicate": false,
"changed": "2025-12-10T16:04:54+03:00",
"closed": null,
"activity": "2025-12-10T16:04:42+03:00",
"guid": "{99502976-b2a2-4246-8d35-c6943b5ff242}",
"xmlId": null,
"exchangeId": null,
"exchangeModified": null,
"outlookVersion": 12,
"mark": "none",
"allowsChangeDeadline": false,
"allowsTimeTracking": false,
"matchesWorkTime": false,
"addInReport": null,
"isMultitask": false,
"siteId": "s1",
"deadlineCount": null,
"declineReason": null,
"forumTopicId": null,
"link": "/company/personal/user/1/tasks/task/view/3835/",
"rights": {
"read": true,
"watch": true,
"mute": true,
"createResult": true,
"edit": true,
"remove": true,
"complete": true,
"approve": false,
"disapprove": false,
"start": true,
"take": false,
"delegate": true,
"defer": true,
"renew": false,
"deadline": true,
"datePlan": true,
"changeDirector": false,
"changeResponsible": true,
"changeAccomplices": true,
"pause": false,
"timeTracking": false,
"mark": true,
"changeStatus": true,
"reminder": true,
"addAuditors": true,
"elapsedTime": true,
"favorite": true,
"checklistAdd": true,
"checklistEdit": true,
"checklistSave": true,
"checklistToggle": true,
"automate": true,
"resultEdit": false,
"completeResult": true,
"removeResult": false,
"resultRead": false,
"admin": true,
"createSubtask": true,
"copy": true,
"saveAsTemplate": true,
"attachFile": true,
"detachFile": true,
"detachParent": true,
"createGanttDependence": true,
"sort": false
},
"archiveLink": "/bitrix/tools/disk/uf.php?entityId=3835&entity=TASKS_TASK&fieldName=UF_TASK_WEBDAV_FILES&signature=516ff0b54563ff935bbdf891590bed09bf4216db4fdf2df4df20425b7dd341e1&action=downloadArchiveByEntity&ncc=1",
"crmItemIds": [
"D_6529"
],
"requireResult": false,
"matchesSubTasksTime": false,
"autocompleteSubTasks": false,
"allowsChangeDatePlan": false,
"maxDeadlineChangeDate": null,
"maxDeadlineChanges": null,
"requireDeadlineChangeReason": false,
"inFavorite": [],
"inPin": [],
"inGroupPin": [],
"inMute": [],
"dependsOn": [],
"scenarios": [
"default"
]
}
}
}
Возвращаемые данные
result
object
Объект с данными ответа
item
object
Объект со значениями полей задачи. Описание полей задачи со связанными объектами
time
time
Информация о времени выполнения запроса
Обработка ошибок
HTTP-статус: 400
{
"error": {
"code": "BITRIX_REST_V3_EXCEPTION_ENTITYNOTFOUNDEXCEPTION",
"message": "Запись с ID = `2` не найдена"
}
}
| Код | Описание | Значение |
|---|---|---|
Поле |
Описание ошибки | Как исправить |
id |
Обязательное поле id не указано |
Добавьте id в тело запроса |
id |
В поле id требуется тип данных int для такого запроса |
Убедитесь, что значение — число, а не строка |

