I’ve had a very interesting call with a client who was having trouble using the Asana API. They have 3.000 projects and half a million tasks. Each night, they request the API through Integromat for about 200 projects. The code runs for a while, and then stops, with the Asana API basically saying “stop harassing us”. We discussed everything that could go wrong and ways to fix the situation. I was curious to have community inputs as well!
429 errors handling
Integromat might not be handling the 429 rate limit error from Asana. The answer from Asana contains the time you are supposed to wait before the next request. Not handling properly that answer might result in the API stopping you from requesting.
Parallel versus sequential
Requesting 200 projects at the same time, in parallel, might not be a good idea. If that is how your code operates, consider requesting projects one by one, in sequence, to avoid an API overload resulting in errors.
The source times out
Depending on the tools you use for requesting the API, it might have timeouts on its own. Not all code is able to run for several hours in a row without completing.
Too hungry in terms of data
To determine whether or not you hit a rate limit, Asana computes the cost of your request. If you ask for only tasks gid, the cost is low. If you ask for the assignee’s name, email, custom field values… the cost increases. Your requests might be asking for too much and you probably have room for improvements by requiring less.
It is better to ask the API for all tasks within a project, and then for the identity of the unique list of assignees, rather than ask for the assignee’s identity for every single task.
Blacklist versus whitelist
Your rate limit depends on the Asana plan your organization is on I believe. A free plan has a lower threshold than a Business plan. What is not said officially is whether or not an account that has been pushing a bit too often above the limit is blacklisted somehow with a lower threshold.
Not using the available libraries
Asana is offering online various client libraries for node, Java, PHP… Those client libraries know how to handle rate limit errors and retry after the correct duration. It is usually a good idea to use one of them instead of re-coding everything from scratch.
Any other ideas about why the API would complain about rate limits or the requesting might stop in the middle?