TermQuery
TermQuery
TermQuery lets you query and retrieve multiple published terms within a specific taxonomy.
| Name | Type | Description |
|---|---|---|
| taxonomyUid | string | UID of the taxonomy |
NoteTermQuery has no public constructor. Get an instance through stack.taxonomy(taxonomyUid).term(), called with no term UID. Passing a term UID to term(termUid) instead returns a Term instance, for a single term.
locale
The locale method scopes the query to terms published in the specified locale.
| Name | Type | Description |
|---|---|---|
| locale (required) | string | Locale code (for example, hi-in, en-us). |
Validation
There is no client-side validation of the locale code. An invalid or unpublished locale is not rejected at this step because locale only stores the value on the query. The API rejects it on the subsequent find() call. See Delivery API Errors.
Behavior
Client-side only. Sets the locale query parameter and returns the same TermQuery instance for chaining. No HTTP call is made until find() is called.
Example
const result = await stack
.taxonomy(taxonomy_uid)
.term()
.locale('hi-in')
.find()includeFallback
The includeFallback method falls back to the master locale for a term that is not localized in the requested locale.
Validation
This method takes no parameters. There is no client-side validation. Calling includeFallback() without first calling locale() does not throw. The API applies its own default locale behavior in that case.
Behavior
Client-side only. Sets the include_fallback query parameter to 'true' and returns the same TermQuery instance for chaining. No HTTP call is made until find() is called.
Example
const result = await stack
.taxonomy(taxonomy_uid)
.term()
.locale('hi-in')
.includeFallback()
.find()find
The find method retrieves a list of all published terms within a specific taxonomy.
Validation
This method takes no parameters. There is no client-side validation. It sends the accumulated query parameters (locale, include_fallback) set by prior chained calls. See Delivery API Errors.
Behavior
Maps to a single GET request to /taxonomies/{taxonomy_uid}/terms with the accumulated query parameters. The full response object is returned as-is (not unwrapped), matching the FindResponse shape used elsewhere in the SDK.
Example
const result = await stack
.taxonomy(taxonomy_uid)
.term()
.find()
// With locale and fallback
const localized = await stack
.taxonomy(taxonomy_uid)
.term()
.locale('hi-in')
.includeFallback()
.find()