Create a search using SQL-like syntax to return items that match specific metadata.
By default, this endpoint returns only the most basic info about the items for
which the query matches. To get additional fields for each item, including any
of the metadata, use the fields
attribute in the query.
This operation is performed by calling function searchByMetadataQuery
.
See the endpoint docs at API Reference.
await client.search.searchByMetadataQuery({
ancestorFolderId: '0',
from: searchFrom,
query:
'name = :name AND age < :age AND birthDate >= :birthDate AND countryCode = :countryCode AND sports = :sports',
queryParams: {
['name']: 'John',
['age']: 50,
['birthDate']: '2001-01-01T02:20:10.120Z',
['countryCode']: 'US',
['sports']: ['basketball', 'tennis'],
},
} satisfies MetadataQuery);
- requestBody
MetadataQuery
- Request body of searchByMetadataQuery method
This function returns a value of type MetadataQueryResults
.
Returns a list of files and folders that match this metadata query.
Searches for files, folders, web links, and shared files across the users content or across the entire enterprise.
This operation is performed by calling function searchForContent
.
See the endpoint docs at API Reference.
await client.search.searchForContent({
ancestorFolderIds: ['0' as string],
mdfilters: [
{
filters: {
['stringField']: 'stringValue',
['dateField']: {
lt: dateTimeFromString('2035-01-01T00:00:00Z'),
gt: dateTimeFromString('2035-01-03T00:00:00Z'),
} satisfies MetadataFieldFilterDateRange,
['floatField']: {
lt: 9.5,
gt: 10.5,
} satisfies MetadataFieldFilterFloatRange,
['enumField']: 'enumValue2',
['multiSelectField']: ['multiSelectValue1', 'multiSelectValue2'],
},
scope: 'enterprise' as MetadataFilterScopeField,
templateKey: templateKey,
} satisfies MetadataFilter,
],
} satisfies SearchForContentQueryParams);
- queryParams
SearchForContentQueryParams
- Query parameters of searchForContent method
- headersInput
SearchForContentHeadersInput
- Headers of searchForContent method
- cancellationToken
undefined | CancellationToken
- Token used for request cancellation.
This function returns a value of type SearchResultsOrSearchResultsWithSharedLinks
.
Returns a collection of search results. If there are no matching
search results, the entries
array will be empty.