tasks.flow.Flow.pin
Закрепить или открепить поток
Описание
Метод tasks.flow.Flow.pin закрепляет или открепляет поток в списке потоков по его идентификатору.
Параметры
flowId
integer
обязательный
Идентификатор потока, который нужно закрепить или открепить.
Получить идентификатор можно методом создания нового потока tasks.flow.Flow.create или методом получения задачи tasks.task.get для задачи из потока
Примеры запроса
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"flowId": 517
}' \
https://your-domain.bitrix24.com/rest/_USER_ID_/_CODE_/tasks.flow.Flow.pin
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"flowId": 517
}' \
https://your-domain.bitrix24.com/rest/tasks.flow.Flow.pin
// 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 PinResult = boolean
try {
const response = await $b24.actions.v2.call.make<PinResult>({
method: 'tasks.flow.Flow.pin',
params: {
flowId: 517,
},
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('Pin result:', result) // true = pinned, false = unpinned
}
} 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 pinFlow() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'tasks.flow.Flow.pin',
params: {
flowId: 517,
},
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('Pin result:', result) // true = pinned, false = unpinned
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', pinFlow)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
try:
bitrix_response = client.tasks.flow.flow.pin(
flow_id=517,
).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.flow.Flow.pin',
[
'flowId' => 517
]
);
$result = $response
->getResponseData()
->getResult();
if ($result->error()) {
error_log($result->error());
echo 'Error: ' . $result->error();
} else {
echo 'Info: ' . print_r($result->data(), true);
}
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error calling tasks.flow.Flow.pin: ' . $e->getMessage();
}
BX24.callMethod(
'tasks.flow.Flow.pin',
{
flowId: 517
},
function(result) {
if (result.error()) {
console.error(result.error());
} else {
console.info(result.data());
}
}
);
require_once('crest.php'); // подключение CRest PHP SDK
$flowId = 517;
// выполнение запроса к REST API
$result = CRest::call(
'tasks.flow.Flow.pin',
[
'flowId' => $flowId
]
);
// Обработка ответа от Битрикс24
if ($result['error']) {
echo 'Error: '.$result['error_description'];
} else {
print_r($result['result']);
}
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "tasks.flow.Flow.pin", b24.Params{
"flowId": 517,
})
if err != nil {
return fmt.Errorf("tasks.flow.Flow.pin: %w", err)
}
var ok bool
if err := json.Unmarshal(res.Result, &ok); err != nil {
return fmt.Errorf("разбор ответа: %w", err)
}
fmt.Println("выполнено:", ok)
Ответ
HTTP-статус: 200
{
"result": true
}
Возвращаемые данные
result
boolean
Результат выполнения метода. Возможные значения:
- true — поток закреплен
- false — поток откреплен
Обработка ошибок
HTTP-статус: 200
{
"error": "0",
"error_description": "Unknown error"
}
| Код | Описание | Значение |
|---|---|---|
0 |
Доступ запрещен или поток не найден | Тариф портала не позволяет работать с потоками или у пользователя нет прав на выполнение операции |
0 |
Unknown error | Неизвестная ошибка |

