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

This code was working but suddenly stopped a few weeks ago.
I belive this is the relavant code section .
Any insights wourl be appreciated
The GIDS appear to be valid and are strings

client = asana.Client.access_token(ASANA_TOKEN)

assign specific fields

task_params = {‘name’: str(self), ‘projects’: [ASANA_PROJECT_GID],
‘memberships’: [{
‘html_notes’: self.task_body_no_links}

assign all other fields as HTML notes

task = client.tasks.create_task(params=task_params)

@Phil_Seeman am I correct to say that you can’t give a membership object like this upon creation, because if you need to move a task to a section it has to be a separate dedicated call?

You can create a task directly in a project / section like this.
Or you can do 2 calls, and just add it to the good section (no need to add it to a project when you specify a section).
So, I don’t know why he gets an invalid request!

I just did a test that was successful, here’s the raw json data I see in fiddler.

POST /tasks

One thing I do notice is the unknown object being retiurned appears to be an int, or least no quotes around it. Could it be that I’m just running an old version of the Asana library, I think it is : asana=0.10.3

I am pretty sure you can’t create a task directly in the right section, last time I checked and talked with Phil I add to do two calls :thinking: but good to know!

Yes you can. But you must provide the project_gid twice, in the “memberships” array AND in the “projects” array. If you only provide memberships, you get an invalid request error.

I don’t recall our conversation, @Bastien_Siebman - I wish I could - but @Frederic_Malenfant is correct, you can use the memberships property at task creation.

1 Like