python asana.error.InvalidRequestError: Invalid Request: projects: [0]: Unknown object:

Hello
I’m trying to create tasks via python.
My request:
client.tasks.create_task(param, opt_pretty=True)

param =
{‘name’: ‘title’, ‘projects’: ‘XXXXXXX’, ‘notes’: ‘text’, ‘assignee’: ‘xxxx@gmail.com’, ‘followers’: [‘xxxx@gmail.com’, ‘xxxx@gmail.com’], ‘memberships’: {‘project’: ‘XXXXXXX’, ‘section’: ‘XXXXXXX’}}

The request throws an error:
asana.error.InvalidRequestError: Invalid Request: projects: [0]: Unknown object: XXXXXXX

I tried to make a request without memberships, the result was the same.
Please tell me what else might be missing?

Hi @Ника_Самойлик and welcome to the forum,

Two issues:

projects needs to be an array; i.e.

"projects": [
  "123456789"
]

assignee and followers need to be user gids.

Hello!)
Thank you.
Thank you.
But the mistake is repeated.
I’m trying a request with an int type for projects. And changed the email to the user’s gid in the request
{‘name’: ‘title’, ‘projects’: [xxxxxxxxx], ‘notes’: ‘text’, ‘assignee’: ‘xxxxxxx’, ‘followers’: [‘xxxxxx’, ‘xxxxxx’]}

The error is the same (I checked it, it’s not private
asana.error.InvalidRequestError: Invalid Request: projects: [0]: Unknown object: xxxxxxxxx

and this
{‘name’: ‘title’, ‘projects’: [‘xxxxxxxxx’], ‘notes’: ‘test’, ‘assignee’: ‘xxxxxxxxx’, ‘followers’: [‘xxxxxxxxx’, ‘xxxxxxxxx’]}

All Asana gids have to be strings, not ints.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.