+ Add Question

API: can't remove tags from a task

AT

Working through API:

1. Insert some task with tags:
Content: "Some tagged task @tag1 @tag2 @tag3".

2. Update this task to remove tags, like this:
Content: "Some tagged task".

3. Bug: but tags (tags ID in JSON) are still present. Doing the same from todoist.com - everything is Ok.

All responses

David Trey staff
Replied on Feb 11, 2013 - 06:34

Hello,

I have passed your question to our developers and I'll inform you as soon as we clarify this matter.


Best regards,
David

David Trey staff
Replied on Feb 12, 2013 - 12:54

Hello,

We've tested this and it seems to work fine, but there are a few unnoticed rules which are unfortunately missing in the documentation which may lead to incorrect use:

1. When a new item is created, all '@smth' strings from it are extracted andadded as item labels. Note that they're effectively cut from the item content itself (we add content "item, we get the item with content "item" and label "foo").

2. When an item is updated, unless the "labels" parameter is explicitly defined, labels aren't removed from the item. Although if the new item content contains '@smth_else' items, labels from it will be extracted and merged with currently defined labels (we update item with content "item, we get the item with content "item" and labels "foo" and "bar").

3. When an item is updated, you can define the list of label ids in the "labels" parameter explicitly, and then label ids will be overridden (we update item with labels "[]", and all the tags will be removed).

Therefore, the only way to detach some labels from an item is to define a new list of attached labels explicitly.


Best regards,
David