Tasks by user and project

Hi guys,

I’m a little confused about your API filters.
I’m coding a simple TODO list in node js / Electron / VueJS and Typescript to catch the daily tasks by user and project. I found in your NodeJS api the method tasks.findAll(), but the filters seemens not working:

client.users.me().then(me => {
client.projects.findByWorkspace(me.workspaces[0].gid).then(projects => {
client.tasks.findAll({worspace: me.worskpaces[0].gid, project: project.id, assignee: me.id})
.then(tasks=>{
console.log(tasks)
})
})
})

This code result in the following error:
{
“message”: “Must specify exactly one of project, tag, section, user task list, or assignee + workspace”,
“help”: “For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors
}

I already tried to remove the workspace and project information, but that resulted in other errors. How the best way to get the task information filtered by user, project, and day? How can I do this with fewer requests?

Thank you!

Hi @Gabriel_Valderramos!

Two things to note:

First, not sure if these typos are in your code or not, but you have two typos in “workspace” here: {worspace: me.worskpaces[0].gid,

Second, as it says in the error message, you need to specify the workspace and also one of either project or assignee, but not both.

1 Like

Hi Phil, thank you for your answer.

Sorry, that was for only to exemplify. You are right the correct is “workspace”. One another mistake in this example was the “projects” promise that returns an array, in my code I did one forEach.

I already tried to remove the assignee and I got the same error:
{
“message”: “Must specify exactly one of project, tag, section, user task list, or assignee + workspace”,
“help”: “For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors
}

My code:

The best world would be if the Asana API has one way to get all tasks with a due date to today, with the assignee to me and, ordered by project, but I don’t know if it is possible, Do anyone know?

Thank you!

@Gabriel_Valderramos,

Ah, what you want to look at is the Search API: Asana

3 Likes