ForumsDevelopers{"errorCode":606,"errorDesc":"You didn't send any tasks to add."


{"errorCode":606,"errorDesc":"You didn't send any tasks to add."
Author Message
mikayla

Posted: Dec 08, 2014
Score: 0 Reference
I keep getting this error whenever I try to add a task regardless of what task data I send. I don't know what is wrong with my encoded string!

I saw another post (http://www.toodledo.com/forums/7/15019/0/error-you-didnt-send-any-tasks-to-add.html) that mentioned encoding Json before the url, but even then it doesn't work for me. The only Json encoding I should need is for the " characters, I am pretty sure.

Here is what I am sending (encoded Json before url):

http://api.toodledo.com/3/tasks/add.php?access_token%3d44a218690fa7b8e44fe5b516d0dc9b8235a1ef61?task s%3d%5B%7B%22folder%22%3A1%2C%22title%22%3A%22TASK+NAME%22%7D%5D?fields%3Dfolder?f%3djson

I simplified it to one task so it's easier to read. The task unencoded is:

[{"folder":1,"title":"TASK NAME"}]

I have even tried using the example on their add tasks site of just the "title" and a generic title test name.

Any help at all is much appreciated!!
Jake

Toodledo Founder
Posted: Dec 08, 2014
Score: 0 Reference
A couple problems I noticed.

1) It looks like you are encoding the entire URL, and not just the data. I can tell because "access_token%3d" should be "access_token=".

2) It looks like you are using the ? symbol to separate arguments. I see it four times in the URL. The ? symbol should only be used once at the very beginning, after ".php" and after that you should use &. This is the standard way that URL params are passed.

So, it should be something like

http://api.toodledo.com/3/tasks/add.php?
access_token=d44a218690fa7b8e44fe5b516d0dc9b8235a1ef61
&tasks=JSON OBJECT
&fields=folder
&f=json

[new lines added for clarity. It should all be on one line]
mikayla

Posted: Dec 09, 2014
Score: 0 Reference
The reason I had the '=' encoded was because when they pass through the GenericUrl() method used to post they disappear and I was not sure what kind of problem that could be causing with the request. I will change that back.

When I switch to the '&' I receive: {"errorCode":611,"errorDesc":"Malformed request."}

I have a JSON Array of objects instead of a JSON Object, because I am passing multiple new tasks.
Jake

Toodledo Founder
Posted: Dec 09, 2014
Score: 0 Reference
Are you POSTing the data to our API?

Here is what a JSON array would look like once encoded:
[{"title"%3A"My Task"}%2C{"title"%3A"Another"%2C"star"%3A"1"%2C"ref"%3A"98765"}%2C{"title"%3A""%2C"ref"%3A"1234"}]
mikayla

Posted: Dec 09, 2014
Score: 0 Reference
That does not make much sense to me. I am doing this in Android (Java) and I would get and IllegalArgumentException on the '[' character immediately.

I managed to get it to work properly with the following hardcoded String:

StringBuilder urlString = new StringBuilder()
.append("http://api.toodledo.com/3/tasks/add.php?access_token=")
.append(cred.getAccessToken())
.append("&tasks=" + URLEncoder.encode("[{\"title\":\"title name\"}]", "utf-8"))
.append("&fields=folder")
.append("&f=json");

GenericUrl url = new GenericUrl(urlString.toString());
HttpRequest request = HTTP_TRANSPORT.createRequestFactory(cred).buildPostRequest(url, null);
HttpResponse response = request.execute();

- - -
However, I need this to work for my list of tasks. I am doing the json encoding before the url encoding.
The task information looks like this when fully encoded:

&tasks=%5B%7B%5C%22folder%5C%22%3A1%2C%5C%22title%5C%22%3A%5C%22TITLE+NAME%5C%22%7D%5D

Translation (only json encoded):
&tasks=[{\"folder\":1,\"title\":\"TITLE NAME\"}]

This malformed error happens regardless of whether I include the folder information.
mikayla

Posted: Dec 09, 2014
Score: 0 Reference
So I think I figured out what the issue is. I can get this to work if I only send 1 or 2 tasks, but when I send all 9 tasks I get a malformed error.

This goes against what it says in your documentation for tasks where it says "You can add up to 50 tasks at a time". I can't even add 10.

My best guess is that this has something to do with url lengths being limited?

See: http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers

But now that I have it working /sometimes/ I can work around the issue of not being able to send them all at once.
Jake

Toodledo Founder
Posted: Dec 09, 2014
Score: 0 Reference
If you are hitting URL length limits of 2048 chars, then it means that you are not submitting the data via POST. POST does not have any restrictions on length. GET does.

http://www.w3schools.com/tags/ref_httpmethods.asp

If you use POST you can definitely submit up to 50 tasks at a time. Our app does this all the time.
You cannot reply yet

U Back to topic home

R Post a reply

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