I’m trying to build an integration that provides a link to a task a user has added in My Tasks. As discussed in Getting a user's "My Tasks" Project ID, My Tasks is a built-in “project”, and the project ID My Tasks isn’t exposed by the API.
If you call /tasks with opt_fields=projects.id, you will see that tasks in My Tasks have no project. Example request:
So, how can I construct (or request) the URL for a task in My Tasks? I tried seeing if there was an undocumented
url field on tasks (i.e. /tasks?opt_fields=url) but there is not. I’m able to construct a URL for tasks in projects, but I’m not able to construct a URL for tasks that are only in My Tasks.
If you construct a URL that looks like this:
and that task exists only in My Tasks, then in my testing when that URL is executed, Asana replaces the second “0” with the Project ID of “My Tasks” and displays that task in the My Tasks view.
Oh sweet, will give that a try. Thanks!
It’s probably better for your API than the <user-id+1> looping hack mentioned here: Programmatically attach user object in notes field I got the loop hack working but will replace the hack with this.
This works, but there is one downside. My app stores various canonical URLs in a table, and the competing URL formats lead to 2 records when I really just want a single record:
It would still make the most sense to provide
/tasks?opt_fields=url to get the URL for a task. Thanks for your help.