I am trying to create a task and assign it to a section using the memberships property. The following code returns an error (the … following the gid indicate the removal of the actual value):
{
“data”: {
“resource_type”: “task”,
“name”: “Test of API Integration”,
“notes”: “API Test Notes”,
“resource_subtype”: “default_task”,
“assignee”: “1204303044…”,
“memberships”: [
{
“projects”: “12045168926…”,
“section”: “1204517290…”
}
]
}
}
JSON response:
{
“errors”: [
{
“message”: “You should specify one of workspace, parent, projects”,
“help”: “For more information on API status codes and how to handle them, read the docs on errors: Errors”
}
]
}
Are you making a call to our Create a task (POST /tasks) endpoint? If so you need to provide one of workspace, parent or projects in your request body in order for the request to succeed. Also, if you take a look at our documentation for request body for our Create a task (POST /tasks) endpoint (See BODY PARAMS section) we do not list memberships as an option in our request body.
If you want to create a task in a project and add it to a section I would suggest:
Make a request to our Create a task (POST /tasks) endpoint and provide the project_gid in the projects request body params. So for example:
{
"data": {
"resource_type": "task",
"name": "Test of API Integration",
"notes": "API Test Notes",
"resource_subtype": "default_task",
"assignee": "1204303044",
"projects": ["12045168926"]
}
}