ForumsDevelopersInvalid Parent ID


Invalid Parent ID
Author Message
Benjamin Leclerc

Posted: Apr 12, 2012
Score: 1 Reference
Hi,

I'm the developer of TaskUnifier.
Sometimes, the users are reporting me the following error "Invalid Parent ID".

As TaskUnifier also handles sub-sub-...-tasks, sometimes I simply remove the parent of the edited tasks in Toodledo, then I reset the correct parent (in Toodledo).
It's easier.

The problem always happens when I try to edit multiple tasks with parent = 0.
However, parent = 0 should never return an "Invalid Parent ID".

Could you confirm this ?
Could you check if there is not a problem removing the parent, when multiple tasks are edited in the same api call ?

Thank you,

Benjamin
Jake

Toodledo Founder
Posted: Apr 12, 2012
Score: 0 Reference
I just looked at the code, and it appears that the "invalid parent id" error is returned in two circumstances

1) The parent doesnt exist
2) The parent is itself a subtask (no sub-sub tasks)

Setting the parent = 0 should not give an error and I could not reproduce it when I tried to multi-edit 3 tasks to parent=0. Can you please double check your code and make sure that you aren't sending a value other than zero?
Benjamin Leclerc

Posted: Apr 20, 2012
Score: 1 Reference
One of my customer kindly allow me to reproduce this error on his account :
I modified my software for the test in order to only send the id and the parent, and it seems that all the tasks receive an invalid parent ID.
I hope it helps.
99% of the time it works, but sometimes this happens.

JSon tasks parameter:

[{"id":"262914845","parent":"0"},{"id":"262914847","parent":"0"},{"id":"262914849","parent":"0"},{"i d":"262914851","parent":"0"},{"id":"262914853","parent":"0"},{"id":"262914855","parent":"0"},{"id":" 262914857","parent":"0"},{"id":"262914859","parent":"0"},{"id":"262914861","parent":"0"},{"id":"2629 14863","parent":"0"},{"id":"262914865","parent":"0"},{"id":"262914867","parent":"0"},{"id":"26291486 9","parent":"0"},{"id":"262914871","parent":"0"},{"id":"262914873","parent":"0"},{"id":"262914875"," parent":"0"},{"id":"262914877","parent":"0"},{"id":"262914879","parent":"0"},{"id":"262914881","pare nt":"0"},{"id":"262914883","parent":"0"},{"id":"262914885","parent":"0"},{"id":"262914887","parent": "0"},{"id":"262914889","parent":"0"},{"id":"262914891","parent":"0"},{"id":"262914893","parent":"0"} ,{"id":"262914895","parent":"0"},{"id":"262914897","parent":"0"},{"id":"262914899","parent":"0"},{"i d":"262914901","parent":"0"},{"id":"262914903","parent":"0"},{"id":"262914905","parent":"0"},{"id":" 262914907","parent":"0"},{"id":"262914909","parent":"0"},{"id":"262914911","parent":"0"},{"id":"2629 14913","parent":"0"},{"id":"262914915","parent":"0"},{"id":"262914917","parent":"0"},{"id":"26291491 9","parent":"0"},{"id":"262914921","parent":"0"},{"id":"262914923","parent":"0"},{"id":"262914925"," parent":"0"},{"id":"262914927","parent":"0"},{"id":"262914929","parent":"0"},{"id":"262914931","pare nt":"0"},{"id":"262914933","parent":"0"},{"id":"262914935","parent":"0"},{"id":"262914937","parent": "0"},{"id":"262914939","parent":"0"},{"id":"262914941","parent":"0"},{"id":"262914943","parent":"0"} ]


Response:

<?xml version="1.0" encoding="UTF-8"?><tasks><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error><error id='13'>Invalid parent ID</error></tasks>


This message was edited Apr 20, 2012.
Benjamin Leclerc

Posted: Apr 20, 2012
Score: 1 Reference
What is strange, is that when I update all the tasks one by one, only one task returns an error: "Invalid ID number".

Maybe the error message "Invalid parent ID" is not the correct error message ?
Jake

Toodledo Founder
Posted: Apr 23, 2012
Score: 1 Reference
I cannot figure this one out. I have tried to reproduce it myself by creating a parent task with multiple subtasks. I then multi-edit all the subtasks to parent=0. This is working for me.

I looked through the code and cannot see how setting parent=0 would ever give an invalid parent id. I even artificially sent an invalid parentID on one of the tasks to see if the error was incorrectly getting copied and I got what I expected, one error and the rest successes.

I did notice that in your code above that you have spaces where there should not be spaces. For example, you have "pare nt" as one of the fields where it should be one word. Is this a copy and paste error, or are you actually sending a field with a space in it?

When you send the tasks one by one and get only one error, can you determine if that error is correct based on what you sent?

My best guess at this point is that the data you think you are posting to Toodledo is not what you are actually posting. Somewhere after you print it and before you send it, something is getting modified. Perhaps the JSON is not validly generated.
Benjamin Leclerc

Posted: Apr 24, 2012
Score: -1 Reference
Well, it works in 99,99% percent of the cases. Everytime exactly the same piece of code is used to update tasks.

So, I really doubt there is a problem in my code.

Concerning the spaces, it's a copy paste error (I checked the spaces and there is a space every 101 characters). Probably a line feed in the console.
Jake

Toodledo Founder
Posted: Apr 24, 2012
Score: 0 Reference
When you send the tasks one by one and get only one error, can you determine if that error is correct based on what you sent?
Benjamin Leclerc

Posted: May 16, 2012
Score: -1 Reference
Hi,

I could reproduce this on my account.

These are the parameters :
[{"reschedule":"0","starttime":"0","status":"0","location":"0","tag":"","timeron":"0","repeatfrom":" 0","star":"0","parent":"0","repeat":"","goal":"0","remind":"0","id":"267320002","folder":"0","title" :"b2","startdate":"0","priority":"0","timer":"0","duetime":"0","length":"0","context":"0","duedate": "0","note":"","completed":"0"}]

You can try to update the task on my account, I only use this account for testing, it doesn't contain any valuable data.

This returns an Invalid Parent ID, and you can see that the parent is 0.

Thanks
Jake

Toodledo Founder
Posted: May 17, 2012
Score: 1 Reference
Task #267320002 does not exist.
Benjamin Leclerc

Posted: May 18, 2012
Score: -1 Reference
Hi,

Ok, then there is a problem at my side and yours :)

The error should be :
7 : Invalid task ID number.

What do you think ?

Ben
Jake

Toodledo Founder
Posted: May 18, 2012
Score: 0 Reference
Yes. When you are editing the parent of an invalid task we are sending back the wrong error message. I have already fixed this on our development server and will push out this fix soon.
You cannot reply yet

U Back to topic home

R Post a reply

To participate in these forums, you must be signed in.