Filtering the Data coming via API. ( Python)

I’m fetching all the tasks and subtasks also via the “gid” of each task. The issue I’m facing is that once I start fetching the sub-tasks also the number of total tasks increases a lot so is there any way I can put any date filter like tasks created after a certain date only should be fetched. This is the snippet I’m using to fetch the tasks:-
*client.tasks.find_by_project(project[‘gid’], {“opt_expand”:"name, *
*projects, workspace, gid, due_on, created_at, modified_at, completed, *
completed_at, assignee, parent, notes, tags,"}) .Let me know if there is any documentation on parameters where it is mentioned how to add these filtering fields if any. Thank you.

Hi @Adnan_Niaz_Bandey and welcome to the forum!

Yes, you can use the Search API for that purpose; see:

https://developers.asana.com/docs/search-tasks-in-a-workspace

4 Likes

Thank you for such a quick response @Phil_Seeman. I’m getting the following error “PremiumOnlyError: Payment Required: Search is only available to premium users.” Does this for sure mean the workspace isn’t a premium or I’m not in that team of premium users that’s why I’m getting this because I’m using my token. Let me know if there is any way to check if the workspace is premium or not so I can take the further decision accordingly.

1 Like

Because the premium access is based on different status (your membership in the workspace, your user status, and the status of the workspace), the only way to know if you have access to the search api, is to call it.
When you get that error, you don’t have access, but there’s no other method to know it before testing it!

3 Likes