Skip to content

Latest commit

 

History

History
68 lines (50 loc) · 5.68 KB

TypeaheadApi.md

File metadata and controls

68 lines (50 loc) · 5.68 KB

asana.TypeaheadApi

All URIs are relative to https://app.asana.com/api/1.0

Method HTTP request Description
typeahead_for_workspace GET /workspaces/{workspace_gid}/typeahead Get objects via typeahead

typeahead_for_workspace

Get objects via typeahead

Retrieves objects in the workspace based via an auto-completion/typeahead search algorithm. This feature is meant to provide results quickly, so do not rely on this API to provide extremely accurate search results. The result set is limited to a single page of results with a maximum size, so you won’t be able to fetch large numbers of results. The typeahead search API provides search for objects from a single workspace. This endpoint should be used to query for objects when creating an auto-completion/typeahead search feature. This API is meant to provide results quickly and should not be relied upon for accurate or exhaustive search results. The results sets are limited in size and cannot be paginated. Queries return a compact representation of each object which is typically the gid and name fields. Interested in a specific set of fields or all of the fields?! Of course you are. Use field selectors to manipulate what data is included in a response. Resources with type user are returned in order of most contacted to least contacted. This is determined by task assignments, adding the user to projects, and adding the user as a follower to tasks, messages, etc. Resources with type project are returned in order of recency. This is determined when the user visits the project, is added to the project, and completes tasks in the project. Resources with type task are returned with priority placed on tasks the user is following, but no guarantee on the order of those tasks. Resources with type project_template are returned with priority placed on favorited project templates. Leaving the query string empty or omitted will give you results, still following the resource ordering above. This could be used to list users or projects that are relevant for the requesting user's api token.

(more information)

Example

import asana
from asana.rest import ApiException
from pprint import pprint

configuration = asana.Configuration()
configuration.access_token = '<YOUR_ACCESS_TOKEN>'
api_client = asana.ApiClient(configuration)

# create an instance of the API class
typeahead_api_instance = asana.TypeaheadApi(api_client)
workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization.
resource_type = "user" # str | The type of values the typeahead should return. You can choose from one of the following: `custom_field`, `goal`, `project`, `project_template`, `portfolio`, `tag`, `task`, `team`, and `user`. Note that unlike in the names of endpoints, the types listed here are in singular form (e.g. `task`). Using multiple types is not yet supported.
opts = {
    'type': "user", # str | *Deprecated: new integrations should prefer the resource_type field.*
    'query': "Greg", # str | The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results.
    'count': 20, # int | The number of results to return. The default is 20 if this parameter is omitted, with a minimum of 1 and a maximum of 100. If there are fewer results found than requested, all will be returned.
    'opt_fields': "name", # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
}

try:
    # Get objects via typeahead
    api_response = typeahead_api_instance.typeahead_for_workspace(workspace_gid, resource_type, opts)
    for data in api_response:
        pprint(data)
except ApiException as e:
    print("Exception when calling TypeaheadApi->typeahead_for_workspace: %s\n" % e)

Parameters

Name Type Description Notes
workspace_gid str Globally unique identifier for the workspace or organization.
resource_type str The type of values the typeahead should return. You can choose from one of the following: `custom_field`, `goal`, `project`, `project_template`, `portfolio`, `tag`, `task`, `team`, and `user`. Note that unlike in the names of endpoints, the types listed here are in singular form (e.g. `task`). Using multiple types is not yet supported. [default to user]
type str Deprecated: new integrations should prefer the resource_type field. [optional] [default to user]
query str The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results. [optional]
count int The number of results to return. The default is 20 if this parameter is omitted, with a minimum of 1 and a maximum of 100. If there are fewer results found than requested, all will be returned. [optional]
opt_fields Dict This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. [optional]

Return type

generator

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json; charset=UTF-8

[Back to top] [Back to API list] [Back to README]