Subtask API permission error

Hi there,

I’m currently extracting subtasks from the Asana API using Python. I’ve stored a list of task_ids (similar to task[‘gid’] generated from the GET tasks endpoint) but I end up with an access error.

        subtasks = client.tasks.get_subtasks_for_task(task, {"opt_expand": "name, \
            projects, workspace, gid, due_on, created_at, start_on, modified_at, completed, \
            completed_at, assignee, parent, notes, tags, team, memberships"}, iterator_type="items")

Do you know how I can resolve this? The current script is looking through task ids and extracting subtasks from private projects, but the task ids are all tasks that were extracted using the same personal account token.

Thanks,
Mae

Please read this before posting

  • If you received an error from the API that you’re looking for help with, please include the error in your post and be descriptive of the requests you made that received the errors. To be clear, we need the error in the JSON response from the API, not the error your code raised.
  • Do not share any API credentials. Please check that the code you’re pasting into the post does not contain any real OAuth tokens or personal access tokens. If you have exposed credentials, you should revoke them immediately.

Just wanted to add that this is the following error generated:

asana.error.ForbiddenError: Forbidden: You do not have access to this parent.

Given that, I’m personally stumped as to why you’d get that error.

I’m curious if you omit the opt_expand portion of your request and just do the most basic attempt to read the subtasks, do you still get the error or does that work?

Hi @Phil_Seeman,

I omitted the opt_expand portion of the request but I still get the following error:

raise STATUS_MAP[response.status_code](response)
asana.error.ForbiddenError: Forbidden: You do not have access to this parent.

If it helps, I can provide an example of one of the task_ids that raises the error.

No, your task Ids won’t mean anything for me, I won’t have access to them in my account.

Two more tests I would try:

  1. What if you try to access one of the parent tasks (the ones whose Ids you saved off) from your browser by replacing the task id in this string and pasting into your browser’s address bar: Log in - Asana ? Can you access the task?

  2. If that works and you can access the task from your browser, what happens if you do an API call to read one of the parent tasks directly (forget about subtasks just for this test)? Do you also get the error?