Eric Shim
Eric Shim

Reputation: 55

Creating a task in a project with curl

I want to create a task in a specific project. But when I post it, I get below error.

{"errors":[{"message":"projects: [0]: Not an ID: [object Object]"}]}

I posted using curl and below is the data. (Typo updated)

curl -H "Content-Type: application/json" -u 2BC1ks3G.OaTb9R00HSdIQkF0aRottLj: https://app.asana.com/api/1.0/tasks --data '{
    "data": {
        "assignee": 123,
        "followers": [
            {
                "id": 456
            }
        ],
        "name": "Hello, world! ",
        "notes": "How are you today?",
        "projects": [{"id": 1000001}],
        "workspace": 7762331677906
    }        
 }'

Upvotes: 1

Views: 343

Answers (1)

agnoster
agnoster

Reputation: 3784

Instead of "projects": [{"id": 1000001}] you actually just need "projects": [1000001] - we have a task for ourselves to fix the way this is mapped (since the form you have is the correct output format, and they should really be consistent). Of course the same format should work both ways! We just have a billion (numeric accuracy may be hyperbolic) other things we're building in the API so I'm not sure when that will happen.

Sorry for the inconvenience, and I hope that helps in the meantime!

Upvotes: 1

Related Questions