I
I
IvanovIvanIvanych2020-07-30 16:24:26
Bitrix24
IvanovIvanIvanych, 2020-07-30 16:24:26

How to add a tag to a task using a webhook?

Hello, please tell me how to add a tag to a task using a webhook? Tried to use similar link "**********/tasks.task.update?taskId=3564&fields[TAGS]=110" and get error {"error":1,"error_description":"**** ***: Task not found or not accessible"}. The part of the link under the asterisks is correct, with its help I successfully turn the task into a subtask.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Edward, 2020-07-31
@IvanovIvanIvanych

Your error says that the task was not found. And tags must be passed as an array.

A
Andrey Nikolaev, 2020-07-31
@gromdron

You are again asking 2 questions in one, which is not very good.
As for the error you're getting: it says in English "Task not found or you don't have access".
This means that either a task with this id does not exist, or the user from which the webhook was created does not have a role (previously) or does not have access (does not see it in the interface) for this task.
As for adding tags: Bitrix24 does not provide a mechanism for adding tags, there is only a replacement of the value in the field.
Every time you make a request, all the tags (that's one field) are replaced by the new ones.
Accordingly, in order to add tags, you must get all the tags, add the necessary ones and install them. And yes - this will require 2 accesses (to receive and to update).
As for the number of tags, the usual http protocol applies here and the transmission of hierarchical structures in the GET parameters, i.e. to set 2 tags, the request will look like:

/tasks.task.update?taskId=3564&fields[TAGS][]=тег1&fields[TAGS][]=тег2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question