Closed tomsdalton closed 7 years ago
I can confirm this behaviour, screenshots below:
Script output: (I added a few lines to debug)
How it looks on todoist.com:
Looking through the docs, I don't see a mention of parent_id
as a parameter at all 🤔
There is a parameter named indent
though - looks like it is related.
The indent of the task (a number between 1 and 4, where 1 is top-level).
Using indent
seemed to work.
I replaced bTask.update(parent_id=aTask['id'])
with bTask.update(indent=2)
. parent_id
is returned as null
, but it renders properly on Todoist.com:
Interestingly, if the task is made into a subtask through another todoist service (e.g. todoist.com) the JSON retrieved by the api is the same as that for the subtask made through the api - however the api made subtask does not appear as a subtask on other todoist services.
My guess is that parent_id
was deprecated in favor of indent
, and that the web version sends both parameters (maybe part of a backward-compatible/parallel change). That should explain the above.
The current way of figure out the tasks and sub-tasks hierarchy is by using the item_order
and indent
properties of item objects inside each project. The first orders the items from 1
, 2
, and up to the last, while the indent
adds indentation to a task to make it a sub-task of the task that is above it and has a lower indent
level.
Imagine these tasks, and observe the values of the aforementioned properties inside the parentheses:
- A (1, 1)
- B (2, 1)
- C (3, 2)
- D (4, 3)
- E (5, 2)
-F (6, 1)
Now the parent_id
is an experimental property, that only some of our clients are using, as we try to simplify the above scheme. You shouldn't rely on it, or actually pay any attention to it at the moment.
We will probably look into hiding it somehow for other users of our API, until we have something solid, that can be used by everyone.
Hope this clears things up.
Hi,
Having issues creating subtasks, code example at bottom.
A task is updated to have parent_id of desired parent task. When persisted the subtask does not appear as a subtask on other todoist services. When subtask is retrieved again through the api, interrogating the JSON shows the task still has the parent_id set correctly.
Interestingly, if the task is made into a subtask through another todoist service (e.g. todoist.com) the JSON retrieved by the api is the same as that for the subtask made through the api - however the api made subtask does not appear as a subtask on other todoist services.
Thanks for your time, Tom
`
`