+ Add Question

Todoist API and the "children" field part 2

AH

This is a follow up to a previous problem which you fixed. Ok, I'm working with the API, specifically I want to imitate the behavior of todoist when I do "add task below". In my current problem I'm adding below a task that is itself a parent task and it is open. When doing this on the website it places the task right after the opened parent on the same indentation level and the new task becomes the parent of the children. Make sense so far?

So I'm doing the same in my application however I notice that even though I add a new task after a task that is an opened parent everything works however the old parent still shows in its "children" field all the ids of the children that now belong to the new task. The UI in both my application and the website shows everything in the right order however I think it's still a problem if the data itself is showing the children field has having children when it no longer does. Trying to call the updateItem api method on the old parent and passing the children variable doesn't have any effect. Some help or guidance please? I know this post is confusing so ask me any questions to clarify. Thanks in advance.

All responses

David Trey staff
Replied on May 31, 2012 - 13:22

Hello Andrew,

thank you for reporting this issue, it has been fixed now as we've added an extra "children" parameter to /API/addItem and /API/updateItem.

You can read about it in the documentation: https://todoist.com/API/


Best regards,
David

AH
Andrew Hewitt premium
Replied on Jun 24, 2012 - 05:00

Hi David,

I switched a while back to only using the newer Sync API, is there any support for the children field there? It is not listed in the documentation. It would be helpful because as it is right now if a task is added through the sync api that has sub-tasks then on the search/agenda page the task does not show up as having children.

Amir Salihefendic staff
Replied on Jun 24, 2012 - 13:23

Hi Andrew

Which commands are you calling? Children of a task should be auto updated by us.

Best regards,
Amir

AH
Andrew Hewitt premium
Replied on Jun 25, 2012 - 05:20

Ok, here's what I'm doing, all in separate steps via the sync API (which has been a life saver might I add). First I add a task with a due date of today like so:
api_token=a511...&items=[
{
"type":"item_add"
,"temp_id":"_1340636241.547"
,"args": {
"item_order":1
,"priority":1
,"project_id":1737841
,"indent":1
,"content":"Test parent task"
,"date_string":"25. Jun 2012"
,"due_date":"2012-6-25T23:59"
}
,"timestamp":"1340636241.609"
}
]

Then I add one below it at the same indent:
api_token=a511...&items=[
{
"type":"item_add"
,"temp_id":"_1340636307.107"
,"args":{
"item_order":2
,"priority":1
,"project_id":1737841
,"indent":1
,"content":"Sub task"
,"date_string":""
,"due_date":null
}
,"timestamp":"1340636307.111"
}
]
This returns an id of: 16015486

I then indent this task to indentation level 2 like so:
api_token=a511...&items=[
{
"args":{
"item_order":2
,"priority":1
,"project_id":1737841
,"id":"16015486"
,"indent":2
,"content":"Sub task"
,"date_string":""
,"due_date":null
}
,"type":"item_update"
,"timestamp":"1340636331.205"
}
]

Everything shows up fine in Allegheny. On the site, it shows fine in the project, the task and sub task is there with the sub task indented. However on the agenda screen the task shows up due today but there is NO arrow next to it to allow it to be opened. If I try the same sequence of steps manually on the site it works and the arrow shows up. What am I doing wrong?

David Trey staff
Replied on Aug 07, 2012 - 12:46

Hello Andrew,

children can be now supplied to item_update command (it should be formated as "1,2,3,4" - - where the numbers are child ids).


Best regards,
David