Currently, to get the GID of a project in a workspace, I have been querying the workspace to retrieve a list of all the projects (as per Build an app with Asana) then filtering the results by the name of the project.
Similarly, if I want to get a custom field in a workspace, I query the workspace for all the custom fields, then filter those by name (Build an app with Asana).
This feels inefficient because I don’t want everything. Is there a way I can query a workspace, filtering on name, so I only get the results for the things with a matching name?
You bet - you can use the Search API for that purpose:
1 Like
The search API looks great for finding tasks. I don’t see how to search for other resource types (projects, etc.) though. Is that possible?
If you only need to match on the name of the object, our typeahead endpoint should fit your use case. It allows you “search” for tasks, projects, tags, users, teams, and custom fields.
3 Likes
@Joe_Trollo Is there a way to search for sections using the name with the typeahead endpoint? The docs don’t mention it but if there is any other way, it would be great to know since our use case demands it.
Hi @sumedh_nimkarde and welcome to the forum!
(FYI Joe Trollo is no longer with Asana.)
Unfortunately typeahead doesn’t support sections.
I’m not sure it would work that well, or be really needed, for sections in any case. If you’re just looking for sections within one project, there are likely never going to be that many so you could read them all and display the in a dropdown list; if you’re looking for them across all projects it seems you’re likely to get a lot of duplicates and/or confusing results since sections are often very project-specific (although of course that really depends ultimately on how you’re using them).