Dependencies not returned in API call

Briefly describe (1-2 sentences) the Bug you’re experiencing:
When using the Asana API (e.g. /tasks/<task_id>) and selecting “dependencies” and/or “dependents” under the opt_fields parameter I’ve came across a set of tasks that don’t return any dependencies/dependents BUT which do return those fields when calling the corresponding dedicated APIs (/tasks/<task_id>/dependencies and /tasks/<task_id>/dependents).

The incorrect behavior only happens in a subset of the tasks being iterated.

Steps to reproduce:

  1. access the Tasks API:
    /tasks/1123543012906810?opt_pretty=true&opt_fields=name,dependents

  2. access the Task Dependents API:
    /tasks/1123543012906810/dependents?opt_fields=name&opt_pretty=true

(Note: scrubbed the task names)

  1. the first API call has an empty dependents array () while the second one has 4 entries.
    These relationship between the tasks can be seen in the Web UI when browsing the dependents,(e.g. <ASANA.COM>/0/1122540251010028/1123568154469458).

Browser version: N/A

Upload screenshots below:

(can only share 1 screenshot since I’m a new user here… when accessing this link in the browser the 4 dependents entries are visible)

Hi @Davide_Marques and welcome to the forum,

Hmmm, personally I haven’t run across that before.

I don’t think it should make a difference but just to see, try using opt_expand instead:

/tasks/1123543012906810?opt_expand=dependents

Do you get any dependent return data?

cc: @Joe_Trollo

1 Like

Hi @Phil_Seeman! Thanks for your quick reply.

I had also explored that approach. It also returns an empty dependents array:

I wonder if it could be a permissions issue? Are you sure you (i.e. the user account you’ve authenticated to) have access to those dependent tasks?

I can see all tasks in the Web UI so that’s not the case.
If it was a permissions issue then the calls to /tasks/<task_id>/dependencies or /tasks/<task_id>/dependents should also not return any results.

It seems to be a bug in the logic that fetches the dependencies via opt_fields (not sure what’s different in those specific tasks but the results across the 2 APIs should be coherent).

Good point.

Agreed.

I do know that I use the /tasks/<task_id>/dependencies and /tasks/<task_id>/dependents endpoints to get my dependency info for Flowsana, not the /tasks/<id>?opt_fields=dependents endpoint. I do that because historically there was an issue with the latter endpoint incorrectly returning dependencies that had since been deleted (that was due to an internal Asana index caching issue) whereas the former endpoints were always accurate. That issue (which is sort of the opposite of yours - I was getting dependencies I shouldn’t have, you’re not getting ones you should) has since been fixed, but perhaps there’s still some related index-caching issue that’s biting you now.

@Joe_Trollo, any ideas?

I talked to one of our API engineers about it and he’ll look into it. It sounds like they might know whats going on. :slight_smile:

1 Like

Nice! Thanks @Ross_Grambo!