Hi,
So I am working on pulling all of the users and the tasks that they are assigned to. I was wondering using the api, how do I get all unassigned tasks? Is there a special unassigned id?
I would really like to use this type of link https://app.asana.com/api/1.0/tasks?assignee=[unassigned]&workspace=[workplaceid]
Any help would be great thanks!
Hey @wtadmin,
Are you trying to pull every unassigned task in your workspace? If so, that is going to be a lot of data. I recommend narrowing the scope of what you’re trying to pull if possible (e.g. unassigned tasks within a set of projects). Also, make sure to use pagination and be mindful of our various rate limits.
With that said, there are two approaches you could take:
-
Get all of the tasks and then do client-side filtering based on the assignee. You can get all incomplete tasks fairly easily by specifying completed_since=now
on the tasks query . While you can pass a specifc assignee (e.g. assignee=123456
), the /tasks endpoint doesn’t allow you to filter on assignee.any=null
, so you will need to do that client side.
-
Use the search API. For example, you can search for incomplete and unassigned tasks in a workspace like this: GET /workspaces/123456789/tasks/search?completed=false&assignee.any=null&limit=10
Note that the search endpoint is not designed to get every task in a workspace. The results are not stable, so repeating the same query multiple times may return the data in a different order, even if the data do not change. Because of this, the traditional pagination available elsewhere in the Asana API is not available here. However, you can paginate manually by sorting the search results by their creation time and then modifying each subsequent query to exclude data you have already seen. Page sizes are limited to a maximum of 100 items, and can be specified by the limit
query parameter.
3 Likes
Hey Jeff,
Number 2 is exactly what I was looking for. I was trying to pull the unassigned, using the following link https://app.asana.com/api/1.0/tasks?assignee=null&workspace=[myworkspace] and that was throwing back a cannot but null error.
Now that I ran that new code you send me, it is exactly what I need!
Thanks so much for that!
Issue has been solved.
Hi, I am using the 2nd approach provided here, but getting:
'assignee.any: Not a recognized ID: '
I am passing assignee.any=null
in the query param.
Any chances this has changed in the recent past?
@Phil_Seeman can you help? I guess its a long time for the last reply on this thread. Maybe the docs changed here?
Hi @sumedh_nimkarde,
I just tried it and assignee.any=null
in my query string worked for me. So I’m guessing most likely there is some small syntax issue in your request. Can you post the whole exact request and query string you’re sending? Also, try it in the interactive API docs here and see if it works for you there.