Sorry, no results found for "".

Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Search result

Search for results

Returns a list of search results matching your query.

By default, it returns 20 results. You can paginate the results using limit and offset parameters. In any case, a maximum number of 100 results is returned.

Query parameters

filter object

Attributes to filter search results

query string

Text to search

Example: "florence apartments"
fuzzy boolean

When any value is passed, it enables the fuzzy search: the Levenshtein Edit Distance is used to match more results.

build_trigger_id string

The build trigger ID on which the search will be performed. Required if more than one build trigger is present in a project

Example: "44"
locale string

Restrict the search on pages in a specific locale

Example: "it"
page object

Parameters to control offset-based pagination

offset integer

The (zero-based) offset of the first entity returned in the collection (defaults to 0)

Example: 200
limit integer

The maximum number of entities to return (defaults to 20, maximum is 100)

Returns

Returns an array of resource objects of type search_result

Examples

import { buildClient } from "@datocms/cma-client-node";
async function run() {
const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
// iterates over every page of results
for await (const searchResult of client.searchResults.listPagedIterator({
filter: { query: "florence apartments" },
})) {
// Check the 'Returned output' tab for the result ☝️
console.log(searchResult);
}
}
run();