Finding things by name

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 https://asana.com/developers/api-reference/projects#query) 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 (https://asana.com/developers/api-reference/custom_fields#query-metadata).

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