Search code examples
phpasanaasana-api

Create new task in project for other user


I've found some weird behaviour that we're unable to explain.

Creating new tasks via the Asana API works great, by using the https://github.com/ajimix/asana-api-php-class functionalities. We have no problem creating a task for the API Key user, assigning it to a project.

The weird behaviour occurs when we try to assign that task to another team member directly. The following unwanted things occur:

  1. The task can not be found by any of the other team members (even searching does not work)
  2. The user the new task is assigned to does have a new task, but the team can't see it by clicking it's task list.
  3. The task is not in the project as it was before, it has 'No project'. The user does have access to that project.

Any clue about how to debug this even further? Is this an authorization issue? Because, I'm able to assign the task to the other user from asana directly.


Solution

  • The solution was to assign the task to a project in the first call directly. The confusion lies in the parameters for creating a task. We expected that project should be a single integer, but it is projects and an array with one or more projects is expected over there.

    The project was assigned to the given user, but was private. So using addProject in a separate call after the task was created did result into an authorization error.