Asana: adding a task to a project when creating it

I am trying to use the Asana API to create a task assigned to me and added to an existing project.

I tried without specifying the workspace as suggested by someone else, but the task creation is still not running.

jSon I use the following:

{ "data": 
{
"name":"Testing Project",
"followers":[10112, 141516],
"workspace":6789,
"assignee":12345,
"project": 1234
}
}

If I create a task and then send another API call with the following jSon, this works, but that means that I need to create 2 API calls every time I create a task.

{
"project": 1234
}
+3
source share
3 answers

(I work for Asana)

: https://asana.com/developers/api-reference/tasks , - addProject , .

SO, , .

+2

, -. , , "" ( "", ), .

, 'projects' = > {22, 33, 44}.

, https://asana.com/developers/api-reference/tasks

+2

The actual problem is that you are passing an int instead of a string for "projects". Some attributes work well as a string or int (for example, "assignee" or "workspace"), but not "projects".

.. therefore fix json as follows:

{ 
    "data": 
    {
        "name":"Testing Project",
        "followers":[10112, 141516],
        "workspace":6789,
        "assignee":12345,
        "project": "1234"
    }
}

I spent half a day on the day. -

0
source

All Articles