Crappy APIs – Asana

We currently use Asana for some task tracking; it’s a pretty good system. However, I like to do extra stuff with my data – visualise my workflow (kanban?). Asana has a view, ‘Tasks by Project’ which is close, we use these Projects (but they are really Sections) for stages (Icebox, Talk, Make, Test, Beta, Live, Done). One would think that it’s easy to query, via some API the same view of active tickets by these Project (section) groups. It’s actually pretty crap.

Query For Tasks

Well, first we get a list of tasks, like /tasks, from the REST style API.  That makes sense.  But all we get is an array of objects, with ID and Name only!  No additional details.  To find these Secton levels, we have to identify Tasks with names that end with a colon ‘:’ #FFS  This means that we then have to query each task for the details – 2500 additional queries.

Did I mention that we have to retrieve ALL tasks?  This is because the sorting happens in line with the result set.  That is Tasks that appear after a Task COLON item are in that Project (SECTION!).  If you run a query to only find the recently modified Tasks, these Task COLON names don’t appear, because those groups were created more than a year ago.

Identify the Project/Section

Once a list of all 2500+ tasks has been collected, iterate each to get the full details.  Also keep track of which Task COLON the current Task appears after. When you query for Task it has a property called projects.  Which is not related to these Task COLON style Projects (in the UI) but are actually Sections.

In the Asana world there are two things that are Projects.  One are the top level Projects that are created for your teams – Engineering, Marketing, Operations.  Then, once you have selected a Project you can view tasks by Project – but this Project means the task groupings.  For example, selecting the top-level Engineering Project then viewing my Task by Project only shows Tasks in Engineering – not my tasks in Operations or Finance.  It does show my tasks grouped by these Section: dividers.

Like I said, grab the full list of tasks, iterate each and keep track of NameCOLON stuff (/:$/), query each object (cache them too!) to check state, then show in the groups.

Keeping Updated

Not to bad here, I don’t have to requery each Task.  I still have to query/iterate the entire Task list to find the proper Section – but I don’t have to check each task this time, cause I’ve cached the first results.  I then make a second query to Tasks API for the items that have been updated in the last N hours.  Now I only have to re-query those N items.

Closing

It’s pretty bunk I have to maintain so much of the Asana state on my end for what could (should?) be a simple REST query.  For example, the Task listing API could include a little more Task details, or could provide a filter for only not-completed tasks.  The Task Object or even the Task list (when extended) could have an attribute like: “section”: { “id”: #, “name”: “Colon:” }.

There are a few mentions on Quora, StackExchange and even Asana’s own site that these will be addressed but so far the progress has been very slow.