I have 2 questions regarding creating tasks using the asana api:
(https://asana.com/developers/api-reference/tasks)
POST /workspaces/workspace-id/tasks/{data}
If so the following would not work?
POST /projects/project-id/tasks/{data}
In the example in the api documentation the following data is used:
# Request
curl -u <api_key>: https://app.asana.com/api/1.0/tasks \
-d "assignee=1235" \
-d "followers[0]=5678" \
-d "name=Hello, world%21" \
-d "notes=How are you today%3F" \
-d "workspace=14916"
Can I add attachments, stories, tags, hearts etc. to the data block? Or does this have to done with update task endpoint?
In the description of each resource, e.g. the Task, the documentation shows the set of properties that are available on that resource during creation and update. It also shows which of them are read-only which means that you cannot modify them through the creation or update endpoint.
For example, tasks have a hearts
property, but that property is read-only. You cannot currently add hearts via the REST API, though that's on our roadmap.
Tasks do not have a stories
property, so you cannot set those through the POST/PUT endpoint either. However, you can add a story to a task by POSTing to /tasks/:taskid/stories
. Many associations between objects behave this way.