Hi all, I tried to retrieve the number of tasks on this project named Engineer RoadMap by sending a simple get requests to this endpoint (I believe this gets both complete and incomplete tasks)
(I can only upload 1 image. On Asana reporting, there’re ~8600 completed tasks, and ~1000 incomplete tasks)
I thought the Asana reporting might also include the sub-tasks. Hence I wrote a bash script to get all the subtasks, and eventually get this number 259
Adding up with the total tasks above, I only got ~500 tasks and subtasks in total via API call. Meanwhile, the Asana reporting shows up to ~1000 tasks incomplete, and ~8600 tasks completed.
Is there something wrong with the Asana API? Or this has something to do with the Asana reporting? Thank you!
I think the issue is that your request should be using pagination (probably easier via a client library than with cURL) so you’re not seeing all the results via your API call.
@Ipb
Thanks for the info. I was quite aware of the pagination mechanism. I noticed for the above endpoint that I made, since I didn’t put the param limit into the query, all the tasks are returned already and no key-value offset is presented within my API call response.
@Frederic_Malenfant
Thank you for letting me know about the above endpoint. I just tried it with my project_id and seems like that API endpoint doesn’t work It returns no data
No, that’s not how Asana’s pagination works. As the docs say, if you don’t include a limit parameter, you will get partial and inconsistent results; that is, you’ll get some initial portion of the requested data but not all of it, and the amount of data returned is likely to be inconsistent between successive non-paginated calls.
You’ll only get back the pagination info (next_page) if you include the limit parameter.
Bottom line: if you want to get more than 50-100 tasks back, you need to use pagination and that means including the limit parameter.
Hi Phil, thank you for clarifying. I tried filling in limit = 100 and keep using pagination to request the next page. Pagination didn’t go further 3 pages, and the total number of tasks seems like didn’t change much
I tried again with the tasks_count endpoint by filling in opt_fields as what you told (sorry I missed this part)
You missed this part of the docs regarding the task counts endpoint:
The result reflected what I’ve observed, it still showed a total of only 231 tasks - exactly what I got lately.
Back to the root issue, this API endpoint’s response is hugely deflected from the Asana reporting. Honestly, I’m not sure what has been wrong here. Is there something you could help me out with this?
I don’t use reporting or the task count endpoint so I’m not sure how either of those are calculated.
If you go to the actual project in the Asana web application, how many tasks are actually in the project? How many subtasks? Is it in the neighborhood of 250-260, or is it wayyyy bigger than that, in the neighborhood of 8000-9000 (though I don’t expect you to count all of them exactly if it’s that big).